Browse Source

Rename async to emit

pull/7175/head
Rory Powell 4 years ago
parent
commit
1a31dff984
  1. 0
      packages/backend-core/src/events/emit/BBEventEmitter.ts
  2. 0
      packages/backend-core/src/events/emit/index.ts
  3. 8
      packages/backend-core/src/events/events.ts

0
packages/backend-core/src/events/async/BBEventEmitter.ts → packages/backend-core/src/events/emit/BBEventEmitter.ts

0
packages/backend-core/src/events/async/index.ts → packages/backend-core/src/events/emit/index.ts

8
packages/backend-core/src/events/events.ts

@ -2,17 +2,17 @@ import { Event } from "@budibase/types"
import { processors } from "./processors" import { processors } from "./processors"
import * as identification from "./identification" import * as identification from "./identification"
import * as backfill from "./backfill" import * as backfill from "./backfill"
import { emitter, EmittedEvent } from "./async" import { emitter, EmittedEvent } from "./emit"
import * as context from "../context" import * as context from "../context"
import * as logging from "../logging" import * as logging from "../logging"
const USE_ASYNC: any[] = [ const USE_EMITTER: any[] = [
Event.SERVED_BUILDER, Event.SERVED_BUILDER,
Event.SERVED_APP, Event.SERVED_APP,
Event.SERVED_APP_PREVIEW, Event.SERVED_APP_PREVIEW,
] ]
for (let event of USE_ASYNC) { for (let event of USE_EMITTER) {
emitter.on(event, async (props: EmittedEvent) => { emitter.on(event, async (props: EmittedEvent) => {
try { try {
await context.doInTenant(props.tenantId, async () => { await context.doInTenant(props.tenantId, async () => {
@ -46,7 +46,7 @@ export const publishEvent = async (
// in future this should use async events via a distributed queue. // in future this should use async events via a distributed queue.
const identity = await identification.getCurrentIdentity() const identity = await identification.getCurrentIdentity()
if (USE_ASYNC.includes(event)) { if (USE_EMITTER.includes(event)) {
emitter.emitEvent(event, properties, identity) emitter.emitEvent(event, properties, identity)
return return
} }

Loading…
Cancel
Save