Question about Workflow.await and Workflow.sleep

Hi Team,

Need some clarity on the wait and sleep. When a call to

Workflow.await(() → myCondition);

Does it releases the current thread?

in other thread, what I read was

It suspends the workflow execution and later recovers it.

What it means? Does it releases the current thread? and later workflow will be invoked/scheduled again when it receives the signal?

Can you please help on how internally await and sleep work?

The short answer is that a workflow that is blocked for a long time doesn’t consume any resources besides space in the database.

The long answer is that workflows are cached by worker processes. While they are cached, they do use a thread when blocked. But they are kicked out of the cache and release the thread as soon as another workflow has a need.

So don’t fear having a very large number of blocked workflows.