mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: skipLocked when updating lastSeen for toggles
(second attempt) see: #795 for deatils.
This commit is contained in:
		
							parent
							
								
									2a9e5822e7
								
							
						
					
					
						commit
						868001e52c
					
				@ -1,5 +1,9 @@
 | 
			
		||||
# Changelog
 | 
			
		||||
 | 
			
		||||
## 3.17.6
 | 
			
		||||
 | 
			
		||||
- fix: skipLocked when updating lastSeen for toggles (second attempt)
 | 
			
		||||
 | 
			
		||||
## 3.17.5
 | 
			
		||||
 | 
			
		||||
- fix: skipLocked when updating lastSeen for toggles
 | 
			
		||||
 | 
			
		||||
@ -131,14 +131,19 @@ class FeatureToggleStore {
 | 
			
		||||
        return rows.map(this.rowToFeature);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async lastSeenToggles(togleNames) {
 | 
			
		||||
    async lastSeenToggles(toggleNames) {
 | 
			
		||||
        const now = new Date();
 | 
			
		||||
        try {
 | 
			
		||||
            await this.db(TABLE)
 | 
			
		||||
                .whereIn('name', togleNames)
 | 
			
		||||
                .update({ last_seen_at: now })
 | 
			
		||||
                .whereIn(
 | 
			
		||||
                    'name',
 | 
			
		||||
                    this.db(TABLE)
 | 
			
		||||
                        .select('name')
 | 
			
		||||
                        .whereIn('name', toggleNames)
 | 
			
		||||
                        .forUpdate()
 | 
			
		||||
                .skipLocked()
 | 
			
		||||
                .update({ last_seen_at: now });
 | 
			
		||||
                        .skipLocked(),
 | 
			
		||||
                );
 | 
			
		||||
        } catch (err) {
 | 
			
		||||
            this.logger.error('Could not update lastSeen, error: ', err);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user