Rename async to emit

This commit is contained in:
Rory Powell 2022-08-09 14:01:55 +01:00
parent f7210e96e4
commit dd0395995f
3 changed files with 4 additions and 4 deletions

View File

@ -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
} }