Skip to content

Commit

Permalink
emergency fix to improve data consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivo Georgiev committed Jul 15, 2019
1 parent 350f38e commit a4b97e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion services/sentry/eventAggregator.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ function makeRecorder(channelId) {
let saveQueue = Promise.resolve()
const persist = function(toSave) {
saveQueue = saveQueue.then(function() {
return eventAggrCol.insertOne(toSave).catch(function(err) {
// created needs to be set to the latest date right before saving, otherwise we risk data inconsistency when running in clustered mode
return eventAggrCol.insertOne({ ...toSave, created: new Date() }).catch(function(err) {
logger.error('eventAggregator fatal error; will re-try', err)
persist(toSave)
})
Expand Down

0 comments on commit a4b97e9

Please sign in to comment.