From 15b1e5514fdd7e9f683a47445c448cc40998ebaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Thu, 22 Apr 2021 21:51:55 +0200 Subject: [PATCH] fix: skipLocked when updating lastSeen for toggles (second attempt) see: #795 for deatils. --- CHANGELOG.md | 4 ++++ src/lib/db/feature-toggle-store.js | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2950a68b23..07e3e88093 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ - chore(deps): bump y18n from 4.0.0 to 4.0.1 (#775) - Feat: Api-Tokens (#774) +## 3.17.6 + +- fix: skipLocked when updating lastSeen for toggles (second attempt) + ## 3.17.5 - fix: skipLocked when updating lastSeen for toggles diff --git a/src/lib/db/feature-toggle-store.js b/src/lib/db/feature-toggle-store.js index e14ea5449b..8c2ebfd4c1 100644 --- a/src/lib/db/feature-toggle-store.js +++ b/src/lib/db/feature-toggle-store.js @@ -135,10 +135,15 @@ class FeatureToggleStore { const now = new Date(); try { await this.db(TABLE) - .whereIn('name', toggleNames) - .forUpdate() - .skipLocked() - .update({ last_seen_at: now }); + .update({ last_seen_at: now }) + .whereIn( + 'name', + this.db(TABLE) + .select('name') + .whereIn('name', toggleNames) + .forUpdate() + .skipLocked(), + ); } catch (err) { this.logger.error('Could not update lastSeen, error: ', err); }