mirror of https://github.com/nocturn9x/giambio.git
Added a default (5) for io_skip_limit, __repr__ and some extra shutdown code
This commit is contained in:
parent
9128cd9759
commit
f44b3806fe
|
@ -125,10 +125,22 @@ class AsyncScheduler:
|
|||
# Data to send back to a trap
|
||||
self._data: Optional[Any] = None
|
||||
# The I/O skip limit. TODO: Back up this value with euristics
|
||||
self.io_skip_limit = io_skip_limit
|
||||
self.io_skip_limit = io_skip_limit or 5
|
||||
# The max. I/O timeout
|
||||
self.io_max_timeout = io_max_timeout
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
Returns repr(self)
|
||||
"""
|
||||
|
||||
fields = {"debugger", "tasks", "run_ready", "selector", "current_task",
|
||||
"clock", "paused", "has_ran", "current_pool", "io_skip",
|
||||
"deadlines", "_data", "io_skip_limit", "io_max_timeout"
|
||||
}
|
||||
data = ", ".join(name + "=" + str(value) for name, value in zip(fields, (getattr(self, field) for field in fields)))
|
||||
return f"{type(self).__name__}({data})"
|
||||
|
||||
def done(self) -> bool:
|
||||
"""
|
||||
Returns True if there is no work to do
|
||||
|
@ -144,6 +156,8 @@ class AsyncScheduler:
|
|||
"""
|
||||
|
||||
self.selector.close()
|
||||
self.tasks = []
|
||||
self.current_task = self.current_pool = None
|
||||
# TODO: Anything else?
|
||||
|
||||
def run(self):
|
||||
|
|
Loading…
Reference in New Issue