Skip to content

Commit

Permalink
Merge pull request #1080 from botpress/ya-fix-outgoing-queue
Browse files Browse the repository at this point in the history
fix(queue): fix outgoing queue
  • Loading branch information
slvnperron committed Nov 6, 2018
2 parents 3d5a56e + c51608f commit 694dafc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
3 changes: 1 addition & 2 deletions src/bp/core/services/middleware/event-engine.ts
Expand Up @@ -67,8 +67,7 @@ export class EventEngine {

this.outgoingQueue.subscribe(async event => {
const { outgoing } = await this.getBotMiddlewareChains(event.botId)
outgoing.run(event)
// FUTURE: We could notify other nodes that the message was successfully sent
await outgoing.run(event)
})
}

Expand Down
18 changes: 1 addition & 17 deletions src/bp/core/services/queue/memory-queue.ts
Expand Up @@ -44,23 +44,7 @@ export default class MemoryQueue implements Queue {

getQueueId(job: Job): string {
const event = (job as JobWithEvent).event || job

return (
(_.get(event, 'bot.id') ||
_.get(event, 'bot.botId') ||
_.get(event, 'botId') ||
_.get(event, 'raw.bot.id') ||
_.get(event, 'raw.botId') ||
'global') +
'::' +
(_.get(event, 'user.id') ||
_.get(event, 'user.userId') ||
_.get(event, 'userId') ||
_.get(event, 'raw.user.id') ||
_.get(event, 'raw.userId') ||
_.get(event, 'raw.to') ||
'default')
)
return `${event.botId}::${event.channel}::${event.target}`
}

async enqueue(job: Job, retries: number = 0, isPriority: boolean = false) {
Expand Down

0 comments on commit 694dafc

Please sign in to comment.