mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: EventStore#getMaxRevisionId can return null (#4384)
In a new fresh Unleash instance with cache enabled this can cause
feature toggles to never get updated.
We saw in our client that the ETag was ETag: "60e35fba:null" Which
looked incorrect for us.
I also did manual testing and if the andWhere had a value of largerThan
higher than whatever the id was then we would get back { max: null }.
This should fix that issue.
			
			
This commit is contained in:
		
							parent
							
								
									065e3cf67f
								
							
						
					
					
						commit
						58b7930908
					
				| @ -162,7 +162,7 @@ class EventStore implements IEventStore { | ||||
|             ) | ||||
|             .andWhere('id', '>=', largerThan) | ||||
|             .first(); | ||||
|         return row ? row.max : -1; | ||||
|         return row?.max ?? 0; | ||||
|     } | ||||
| 
 | ||||
|     async delete(key: number): Promise<void> { | ||||
|  | ||||
| @ -18,10 +18,11 @@ export default class ConfigurationRevisionService extends EventEmitter { | ||||
|         super(); | ||||
|         this.logger = getLogger('configuration-revision-service.ts'); | ||||
|         this.eventStore = eventStore; | ||||
|         this.revisionId = 0; | ||||
|     } | ||||
| 
 | ||||
|     async getMaxRevisionId(): Promise<number> { | ||||
|         if (this.revisionId) { | ||||
|         if (this.revisionId > 0) { | ||||
|             return this.revisionId; | ||||
|         } else { | ||||
|             return this.updateMaxRevisionId(); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user