documentation icon indicating copy to clipboard operation
documentation copied to clipboard

EDU-3919: Clarification of Go Handlers/Selectors

Open joshmsmith opened this issue 1 year ago • 2 comments

Temporal Affiliation

  • [x] I am a Temporal employee

Content Suggestion

In Go, there was some confusion about if Futures run even if you don't Select() but the docs say:

selector.Select(ctx) is the primary mechanism which blocks on and executes Future work. It is intentionally flexible; you may call it conditionally or multiple times

This seems to conflict with other docs that say things like "ExecuteActivity requests activity execution in the context of a workflow...ExecuteActivity immediately returns a Future that can be used to block waiting for activity result or failure."

So does the Select() let you block while the activity runs or does it actually execute the activity?

I was sure it's nothing runs until you call selector.Select(ctx) from this comment: // API Example: block until the next Future is ready to run // important! none of the deferred code runs until you call selector.Select This was confirmed by testing I did today. But my pause is about the docs which say "request execution". It seems it might be more clear if it says "requests execution to be done upon get() or select()". I think that could be a good clarification. more discussion here

joshmsmith avatar Jan 27 '25 19:01 joshmsmith

Thanks, Josh. Will get this into the system.

fairlydurable avatar Jan 27 '25 19:01 fairlydurable

Commenting here so GitHub sees me as involved. Please forgive me for the extra notification 🙏

GSmithApps avatar Jan 28 '25 21:01 GSmithApps