restore user.running property

it was made a method for handing named_servers,
but that made things way more complicated and replaced a boolean flag with a callable,
which would behave unexpectedly but without error if a boolean flag was expected.

Spawners have properties for dealing with this now, so use spawners

Restore `user.running` as an alias for `user.spawner.ready`
This commit is contained in:
Min RK
2017-08-02 14:20:56 +02:00
parent 210d7e59fd
commit 684afed3f1
13 changed files with 57 additions and 49 deletions

View File

@@ -461,7 +461,7 @@ def test_slow_spawn(app, no_patience, slow_spawn):
@gen.coroutine
def wait_spawn():
while not app_user.running(''):
while not app_user.running:
yield gen.sleep(0.1)
yield wait_spawn()
@@ -538,7 +538,7 @@ def test_slow_bad_spawn(app, no_patience, slow_bad_spawn):
while user.spawner.pending:
yield gen.sleep(0.1)
# spawn failed
assert not user.running('')
assert not user.running
assert app.users.count_active_users()['pending'] == 0
@@ -566,7 +566,7 @@ def test_spawn_limit(app, no_patience, slow_spawn, request):
assert r.status_code == 429
# wait for ykka to finish
while not users[0].running(''):
while not users[0].running:
yield gen.sleep(0.1)
# race? hjarka could finish in this time
@@ -576,7 +576,7 @@ def test_spawn_limit(app, no_patience, slow_spawn, request):
r.raise_for_status()
assert app.users.count_active_users()['pending'] == 2
users.append(user)
while not all(u.running('') for u in users):
while not all(u.running for u in users):
yield gen.sleep(0.1)
# everybody's running, pending count should be back to 0