File tree Expand file tree Collapse file tree
packages/app/server/routes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -195,7 +195,16 @@ export default eventHandler(async (event) => {
195195 templatesHtmlMap [ template ] = new URL ( `/template/${ uuid } ` , origin ) . href ;
196196 }
197197
198- if ( ! currentCursor || currentCursor . timestamp < runId ) {
198+ const LEGACY_MS_TIMESTAMP_CUTOFF = 1e12 ;
199+ const isStaleCursor = ( cursor : { timestamp ?: number } | null ) => {
200+ if ( ! cursor ) return true ;
201+ const ts = Number ( cursor . timestamp ) ;
202+ if ( ! Number . isFinite ( ts ) ) return true ;
203+ if ( ts >= LEGACY_MS_TIMESTAMP_CUTOFF ) return true ;
204+ return ts < runId ;
205+ } ;
206+
207+ if ( isStaleCursor ( currentCursor ) ) {
199208 await cursorBucket . setItem ( cursorKey , {
200209 sha : workflowData . sha ,
201210 timestamp : runId ,
@@ -208,7 +217,7 @@ export default eventHandler(async (event) => {
208217 ) {
209218 const branchCursorKey = `${ baseKey } :${ workflowData . headBranch } ` ;
210219 const branchCursor = await cursorBucket . getItem ( branchCursorKey ) ;
211- if ( ! branchCursor || branchCursor . timestamp < runId ) {
220+ if ( isStaleCursor ( branchCursor ) ) {
212221 await cursorBucket . setItem ( branchCursorKey , {
213222 sha : workflowData . sha ,
214223 timestamp : runId ,
You can’t perform that action at this time.
0 commit comments