Skip to content

Commit

Permalink
scheduler hint with request
Browse files Browse the repository at this point in the history
Summary: https://www.internalfb.com/diff/D57330122?dst_version_fbid=975275170917805&transaction_fbid=1863882647422768

Reviewed By: simonmar

Differential Revision: D57379154

fbshipit-source-id: 77593417465cf6d34e0813abc2dffaa389ba1584
  • Loading branch information
Pepe Iborra authored and facebook-github-bot committed May 16, 2024
1 parent 6cd30c0 commit 42b72a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Haxl/Core/DataSource.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ class (DataSourceName req, StateKey req, ShowP req) => DataSource u req where
schedulerHint :: u -> SchedulerHint req
schedulerHint _ = TryToBatch

schedulerHintState :: Maybe (State req) -> u -> SchedulerHint req
schedulerHintState _ u = schedulerHint u

classifyFailure :: u -> req a -> SomeException -> FailureClassification
classifyFailure _ _ _ = StandardFailure

Expand Down
4 changes: 3 additions & 1 deletion Haxl/Core/Fetch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ dataFetchWithInsert showFn insertFn req =
blockedFetch = BlockedFetch req rvar
blockedFetchI = BlockedFetchInternal fid
submitFetch = do
case schedulerHint userEnv :: SchedulerHint r of
let hint :: SchedulerHint r
hint = schedulerHintState (stateGet states) userEnv
case hint of
SubmitImmediately ->
performFetches env [BlockedFetches [blockedFetch] [blockedFetchI]]
TryToBatch ->
Expand Down

0 comments on commit 42b72a2

Please sign in to comment.