mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Make wait time configurable. Could be needed in slower machines.
This commit is contained in:
parent
c1dbe4fc3c
commit
b60682a1e4
1 changed files with 3 additions and 4 deletions
|
@ -116,7 +116,7 @@ class Taskd(object):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def start(self):
|
def start(self, minutes=5):
|
||||||
"""Start the taskd server if it's not running.
|
"""Start the taskd server if it's not running.
|
||||||
If it's already running OSError will be raised
|
If it's already running OSError will be raised
|
||||||
"""
|
"""
|
||||||
|
@ -127,8 +127,7 @@ class Taskd(object):
|
||||||
raise OSError("Taskd server is still running or crashed")
|
raise OSError("Taskd server is still running or crashed")
|
||||||
|
|
||||||
# Wait for server to listen by checking connectivity in the port
|
# Wait for server to listen by checking connectivity in the port
|
||||||
# Wait up to 5 minutes checking once second
|
# Default is to wait up to 5 minutes checking once each second
|
||||||
minutes = 5
|
|
||||||
for i in range(minutes * 60):
|
for i in range(minutes * 60):
|
||||||
if not self.status():
|
if not self.status():
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
@ -191,6 +190,6 @@ class Taskd(object):
|
||||||
|
|
||||||
def __destroyed(self, *args, **kwargs):
|
def __destroyed(self, *args, **kwargs):
|
||||||
raise AttributeError("Taskd instance has been destroyed. "
|
raise AttributeError("Taskd instance has been destroyed. "
|
||||||
"Create a new instance if you need a new server.")
|
"Create a new instance if you need a new server.")
|
||||||
|
|
||||||
# vim: ai sts=4 et sw=4
|
# vim: ai sts=4 et sw=4
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue