temporal solves another use case for me: I wanted a way to put my computer to sleep via my phone.

I have my Next.js web app starting the workflow and a GoLang worker running on the machine and listening to the respective queue to put it to sleep.

I didn’t want to have the machine or the worker already offline, come online, and then get put right back to sleep via a pending workflow. Or maybe I accidentally put it to sleep a few times via the web app.

The solve is using workflow execution timeout along with limiting maximum attempts to one solves this! If no worker completes the workflow within a minute it times out and won’t get executed. I think this is an awesome solve for the potential issues above.

    await client.workflow.start('WorkflowSleep', {
      workflowId: `gotosleep-${nanoid()}`,
      taskQueue: 'GREETING_TASK_QUEUE',
      workflowExecutionTimeout: '1m',
      retry: {
        maximumAttempts: 1
      }
    });