Worker: prevent machine from going to sleep #99441
Labels
No Label
Good First Issue
Priority
High
Priority
Low
Priority
Normal
Status
Archived
Status
Confirmed
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Job Type
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: studio/flamenco#99441
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Workers should prevent the machine they're running on from going to sleep, otherwise they'll time out.
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @dr.sybren
Here is some research of my findings to fix this issue:
On Windows it is possible to call SetThreadExecutionState on a regular interval with the
ES_SYSTEM_REQUIRED
value to prevent sleep.For MacOS, the Technical Q&A QA1340 under Listing 2, shows how to use I/O Kit to prevent sleep. For usage within Go, MacDriver could work, otherwise cgo can be used to interact with I/O Kit natively.
With Linux, systemd-inhibit can be used to acquire a sleep lock while the program is running.
exec.Command("/bin/bash", "systemd-inhibit program")
.Alternatively, commands like Powercfg on Windows, can disable/enable sleep without elevated permissions, there might be similar ones for the other two platforms.