summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index cd18aa4..2dd433e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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 );