Skip to content

Commit

Permalink
Fix up stream init settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Jan 24, 2025
1 parent a14b424 commit 7938f89
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Share/Web/UCM/SyncV2/Impl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import Share.Web.UCM.Sync.HashJWT qualified as HashJWT
import Share.Web.UCM.SyncV2.Queries qualified as SSQ
import U.Codebase.Sqlite.Orphans ()
import Unison.Debug qualified as Debug
import Unison.Hash32 (Hash32)
import Unison.Share.API.Hash (HashJWTClaims (..))
import Unison.SyncV2.API qualified as SyncV2
import Unison.SyncV2.Types (DownloadEntitiesChunk (..), EntityChunk (..), ErrorChunk (..), StreamInitInfo (..))
Expand All @@ -43,8 +44,8 @@ import UnliftIO.Async qualified as Async
batchSize :: Int32
batchSize = 1000

streamSettings :: StreamInitInfo
streamSettings = StreamInitInfo {version = SyncV2.Version 1, entitySorting = SyncV2.Unsorted, numEntities = Nothing}
streamSettings :: Hash32 -> Maybe SyncV2.BranchRef -> StreamInitInfo
streamSettings rootCausalHash rootBranchRef = StreamInitInfo {version = SyncV2.Version 1, entitySorting = SyncV2.Unsorted, numEntities = Nothing, rootCausalHash, rootBranchRef}

server :: Maybe UserId -> SyncV2.Routes WebAppServer
server mayUserId =
Expand Down Expand Up @@ -90,7 +91,7 @@ downloadEntitiesStreamImpl mayCallerUserId (SyncV2.DownloadEntitiesRequest {caus
pure $ Codebase.codebaseEnv authZToken codebaseLoc
q <- UnliftIO.atomically $ do
q <- STM.newTBMQueue 10
STM.writeTBMQueue q (NEL.singleton $ InitialC $ streamSettings)
STM.writeTBMQueue q (NEL.singleton $ InitialC $ streamSettings causalHash (Just branchRef))
pure q
streamResults <- lift $ UnliftIO.toIO do
Logging.logInfoText "Starting download entities stream"
Expand Down

0 comments on commit 7938f89

Please sign in to comment.