From 0947afee58ebf2f19554878bf640849fcee019fc Mon Sep 17 00:00:00 2001 From: Felipe Cecagno <fcecagno@gmail.com> Date: Wed, 24 Oct 2018 23:50:51 -0300 Subject: [PATCH] save user mapping to memory db before trying to save on redis to avoid inconsistency on the next event --- bbb-webhooks/userMapping.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bbb-webhooks/userMapping.js b/bbb-webhooks/userMapping.js index 1177071904..bf11b4a031 100644 --- a/bbb-webhooks/userMapping.js +++ b/bbb-webhooks/userMapping.js @@ -37,12 +37,13 @@ module.exports = class UserMapping { } save(callback) { + db[this.internalUserID] = this; + this.redisClient.hmset(config.redis.keys.userMap(this.id), this.toRedis(), (error, reply) => { if (error != null) { Logger.error("[UserMapping] error saving mapping to redis:", error, reply); } this.redisClient.sadd(config.redis.keys.userMaps, this.id, (error, reply) => { if (error != null) { Logger.error("[UserMapping] error saving mapping ID to the list of mappings:", error, reply); } - db[this.internalUserID] = this; (typeof callback === 'function' ? callback(error, db[this.internalUserID]) : undefined); }); }); -- GitLab