Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

In-memory action definitions synced with Django #403

Merged
merged 25 commits into from
May 26, 2021
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
42eb852
Add ActionManager
Twixes May 21, 2021
bb45010
Refactor ActionManager
Twixes May 21, 2021
580ffc1
Remove hello
Twixes May 21, 2021
755e5dd
Adjust ActionManager method names and use single PubSub
Twixes May 21, 2021
54f254a
Touch tests up
Twixes May 21, 2021
797d56f
Merge branch 'master' into 235-action-matching
Twixes May 21, 2021
a87a0a0
Make some adjustments
Twixes May 24, 2021
ff0013e
Disable `status` stdout logs in test mode
Twixes May 24, 2021
e12d648
Fix `status`
Twixes May 24, 2021
f3415c8
Fix test problems
Twixes May 24, 2021
a42f6c8
Merge branch 'master' into 235-action-matching
Twixes May 25, 2021
3f5553a
Fix dropAction typo
Twixes May 25, 2021
63785f1
Reload all ActionManager caches every 5 min
Twixes May 25, 2021
e27c039
Merge branch 'master' into 235-action-matching
Twixes May 25, 2021
1590d3c
Fix duplicate RawAction
Twixes May 25, 2021
7f0dc18
Don't stringify JSONB column for `insertRow`
Twixes May 25, 2021
d768f11
It's a hub now
Twixes May 25, 2021
a5be2e4
Filter by Action.deleted
Twixes May 25, 2021
5dde8df
Enhance ActionManager tests
Twixes May 25, 2021
4af1ba7
Add Action-syncing task runner tests
Twixes May 25, 2021
bb606db
Merge branch 'master' into 235-action-matching
Twixes May 25, 2021
8304827
Use `LOG_LEVEL=warn` in tests
Twixes May 26, 2021
c132a53
Don't `throw` error on unassociated channel pubsub
Twixes May 26, 2021
4082003
Don't use defaultConfig in Status.buildMethod due to circular import
Twixes May 26, 2021
6212419
Fix actions reload job var name
Twixes May 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/utils/db/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,16 @@ export class DB {

public async fetchAllActionsMap(): Promise<Record<Action['id'], Action>> {
const rawActions: RawAction[] = (
await this.postgresQuery(`SELECT * FROM posthog_action`, undefined, 'fetchActions')
await this.postgresQuery(`SELECT * FROM posthog_action WHERE deleted = FALSE`, undefined, 'fetchActions')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

).rows
const actionSteps: ActionStep[] = (
await this.postgresQuery(`SELECT * FROM posthog_actionstep`, undefined, 'fetchActionSteps')
await this.postgresQuery(
`SELECT posthog_actionstep.*, posthog_action.deleted FROM posthog_actionstep
JOIN posthog_action ON (posthog_action.id = posthog_actionstep.action_id)
WHERE posthog_action.deleted = FALSE`,
undefined,
'fetchActionSteps'
)
).rows
const actionsMap: Record<Action['id'], Action> = {}
for (const rawAction of rawActions) {
Expand All @@ -746,7 +752,11 @@ export class DB {

public async fetchAction(id: Action['id']): Promise<Action | null> {
const rawActions: RawAction[] = (
await this.postgresQuery(`SELECT * FROM posthog_action WHERE id = $1`, [id], 'fetchActions')
await this.postgresQuery(
`SELECT * FROM posthog_action WHERE id = $1 AND deleted = FALSE`,
[id],
'fetchActions'
)
).rows
if (!rawActions.length) {
return null
Expand Down