File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
libs/langgraph/src/pregel Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -272,10 +272,12 @@ export function _applyWrites<Cc extends Record<string, BaseChannel>>(
272272 . filter ( ( chan ) => ! RESERVED . includes ( chan ) )
273273 ) ;
274274
275+ let usedNewVersion = false ;
275276 for ( const chan of channelsToConsume ) {
276277 if ( chan in onlyChannels && onlyChannels [ chan ] . consume ( ) ) {
277278 if ( getNextVersion !== undefined ) {
278279 checkpoint . channel_versions [ chan ] = getNextVersion ( maxVersion ) ;
280+ usedNewVersion = true ;
279281 }
280282 }
281283 }
@@ -294,7 +296,9 @@ export function _applyWrites<Cc extends Record<string, BaseChannel>>(
294296 }
295297
296298 // Find the highest version of all channels
297- maxVersion = maxChannelMapVersion ( checkpoint . channel_versions ) ;
299+ if ( maxVersion != null && getNextVersion != null ) {
300+ maxVersion = usedNewVersion ? getNextVersion ( maxVersion ) : maxVersion ;
301+ }
298302
299303 const updatedChannels : Set < string > = new Set ( ) ;
300304 // Apply writes to channels
You can’t perform that action at this time.
0 commit comments