Skip to content

Commit

Permalink
fix(webchat): last heard on not updated correctly (#4448)
Browse files Browse the repository at this point in the history
Co-authored-by: Francois-Xavier P. Darveau <955524+EFF@users.noreply.github.com>
  • Loading branch information
allardy and EFF committed Jan 29, 2021
1 parent 2345ae9 commit 15de959
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/channel-web/src/backend/db.ts
Expand Up @@ -9,6 +9,8 @@ import { Config } from '../config'

import { DBMessage } from './typings'

const SEPARATOR = '*'

export default class WebchatDb {
private readonly MAX_RETRY_ATTEMPTS = 3
private knex: sdk.KnexExtended
Expand Down Expand Up @@ -70,7 +72,7 @@ export default class WebchatDb {
const queries = []

for (const key in this.batchedConvos) {
const [conversationId, userId, botId] = key.split('_')
const [conversationId, userId, botId] = key.split(SEPARATOR)
const value = this.batchedConvos[key]

const query = this.knex('web_conversations')
Expand Down Expand Up @@ -180,7 +182,7 @@ export default class WebchatDb {
}

this.batchedMessages.push(message)
this.batchedConvos[`${conversationId}_${userId}_${botId}`] = this.knex.date.format(now)
this.batchedConvos[`${conversationId}${SEPARATOR}${userId}${SEPARATOR}${botId}`] = this.knex.date.format(now)

return {
...message,
Expand Down

0 comments on commit 15de959

Please sign in to comment.