Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ tests:
- require-callstack
- hs-opentelemetry-sdk
- resourcet
- pqueue
main: Main.hs
source-dirs: test
other-modules:
Expand Down
1 change: 1 addition & 0 deletions sdk/temporal-sdk.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ test-suite temporal-sdk-tests
, monad-logger
, mtl
, network
, pqueue
, proto-lens
, proto-lens-protobuf-types
, random
Expand Down
2 changes: 0 additions & 2 deletions sdk/test/IntegrationSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1505,8 +1505,6 @@ needsClient = do
signalWithArgs
1

-- liftIO $ threadDelay 1_000

C.signal wfH signalWithArgs C.defaultSignalOptions 2
lift $ C.waitWorkflowResult wfH `shouldReturn` [1, 2]

Expand Down
10 changes: 6 additions & 4 deletions sdk/test/IntegrationSpec/Signals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Temporal.Duration
import Temporal.Payload
import Temporal.TH
import Temporal.Workflow
import qualified Data.PQueue.Prio.Min as MinPQueue


unblockWorkflowSignal :: KnownSignal '[]
Expand Down Expand Up @@ -57,14 +58,15 @@ registerWorkflow 'signalWithArgsWorkflow

signalEnqueuesItemWorkflow :: Workflow [Int]
signalEnqueuesItemWorkflow = provideCallStack do
var <- newStateVar []
var <- newStateVar MinPQueue.empty
setSignalHandler signalWithArgs $ \i -> do
$(logDebug) "updating value and unblocking workflow"
readStateVar var >>= \s -> writeStateVar var (s <> [i])
t <- now
readStateVar var >>= \s -> writeStateVar var (MinPQueue.insert t i s)
Comment on lines +64 to +65
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fact that this works implies that things are getting processed in-order, so it looks like statevar operations are messed up.

fwiw i also tried this with modifyStateVar & it reproduced the issue which means it's not a read *> write sequence issue.


sleep (seconds 2)

waitCondition $ (not . null) <$> readStateVar var
readStateVar var
waitCondition $ (not . MinPQueue.null) <$> readStateVar var
(map snd . MinPQueue.toList) <$> readStateVar var

registerWorkflow 'signalEnqueuesItemWorkflow