diff options
author | Simon Rettberg | 2019-05-13 16:35:44 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-05-13 16:35:44 +0200 |
commit | 902df6a04aeb776266e605fca782350627e3f802 (patch) | |
tree | 03e95e32ec593e647ecafb2a05a7ad595fe31e74 /src | |
parent | Support --min-idle (diff) | |
download | idle-daemon-902df6a04aeb776266e605fca782350627e3f802.tar.gz idle-daemon-902df6a04aeb776266e605fca782350627e3f802.tar.xz idle-daemon-902df6a04aeb776266e605fca782350627e3f802.zip |
Properly cap sleep after RPC call
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -281,6 +281,11 @@ int main( int argc, char **argv ) } // Handle requests rpcHandle( listenFd ); + // Might have set a new scheduled action + if ( nextAction.deadline != 0 && ( count == 0 || minIdleTime >= config.minIdle || nextAction.force ) ) { + int delta = nextAction.deadline - monoNOW; + CAP_SLEEP( delta ); + } // Sleep until next run //printf( "Sleeping %d seconds\n ", sleepTime ); rpcWait( listenFd, sleepTime > 5 ? sleepTime : 5 ); |