diff --git a/internal/datastore/postgres/watch.go b/internal/datastore/postgres/watch.go index 2c7a2d3c97..1f95a72fcb 100644 --- a/internal/datastore/postgres/watch.go +++ b/internal/datastore/postgres/watch.go @@ -158,18 +158,6 @@ func (pgd *pgDatastore) Watch( optionalNanosTimestamp: currentTxn.optionalNanosTimestamp, } } - - // If checkpoints were requested, output a checkpoint. While the Postgres datastore does not - // move revisions forward outside of changes, these could be necessary if the caller is - // watching only a *subset* of changes. - if options.Content&datastore.WatchCheckpoints == datastore.WatchCheckpoints { - if !sendChange(&datastore.RevisionChanges{ - Revision: currentTxn, - IsCheckpoint: true, - }) { - return - } - } } else { sleep := time.NewTimer(watchSleep) @@ -181,6 +169,18 @@ func (pgd *pgDatastore) Watch( return } } + + // If checkpoints were requested, output a checkpoint. While the Postgres datastore does not + // move revisions forward outside of changes, these could be necessary if the caller is + // watching only a *subset* of changes. + if options.Content&datastore.WatchCheckpoints == datastore.WatchCheckpoints { + if !sendChange(&datastore.RevisionChanges{ + Revision: currentTxn, + IsCheckpoint: true, + }) { + return + } + } } }()