Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(webapp): add option to disable PostgreSQL task-event writes#4242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: feature | ||
| --- | ||
| Added `EVENT_REPOSITORY_POSTGRES_WRITES_DISABLED` to skip all PostgreSQL task-event writes for deployments that store task events in ClickHouse. Leave it off unless `EVENT_REPOSITORY_DEFAULT_STORE` is `clickhouse_v2`, otherwise task events are lost. |
ericallam marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -157,14 +157,23 @@ export class EventRepository implements IEventRepository { | ||
| } | ||
| private async insertImmediate(event: CreateEventInput) { | ||
| if (env.EVENT_REPOSITORY_POSTGRES_WRITES_DISABLED) { | ||
| return; | ||
| } | ||
ericallam marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| await this.#flushBatch(nanoid(), [this.#createableEventToPrismaEvent(event)]); | ||
| } | ||
| insertMany(events: CreateEventInput[]) { | ||
| if (env.EVENT_REPOSITORY_POSTGRES_WRITES_DISABLED) { | ||
| return; | ||
| } | ||
| this._flushScheduler.addToBatch(events.map(this.#createableEventToPrismaEvent)); | ||
| } | ||
| async insertManyImmediate(events: CreateEventInput[]) { | ||
| if (env.EVENT_REPOSITORY_POSTGRES_WRITES_DISABLED) { | ||
| return; | ||
| } | ||
ericallam marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| await this.#flushBatchWithReturn(nanoid(), events.map(this.#createableEventToPrismaEvent)); | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| @@ -1018,7 +1027,7 @@ export class EventRepository implements IEventRepository { | ||
| if (options.immediate) { | ||
| await this.insertImmediate(event); | ||
| } else { | ||
| this._flushScheduler.addToBatch([this.#createableEventToPrismaEvent(event)]); | ||
| this.insertMany([event]); | ||
| } | ||
| } | ||
| @@ -1152,7 +1161,7 @@ export class EventRepository implements IEventRepository { | ||
| if (options.immediate) { | ||
| await this.insertImmediate(event); | ||
| } else { | ||
| this._flushScheduler.addToBatch([this.#createableEventToPrismaEvent(event)]); | ||
| this.insertMany([event]); | ||
| } | ||
| return result; | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.