mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 15:03:02 +00:00
remove Spawner.fromJSON
load state on `__init__` instead Makes more sense now that state can persist across server instances (e.g. docker container_id)
This commit is contained in:
@@ -305,13 +305,17 @@ class User(Base):
|
||||
api_token = self.new_api_token()
|
||||
db.add(api_token)
|
||||
db.commit()
|
||||
|
||||
|
||||
|
||||
spawner = self.spawner = spawner_class(
|
||||
config=config,
|
||||
user=self,
|
||||
hub=hub,
|
||||
api_token=api_token.token,
|
||||
)
|
||||
# we are starting a new server, make sure it doesn't restore state
|
||||
spawner.clear_state()
|
||||
|
||||
yield spawner.start()
|
||||
spawner.start_polling()
|
||||
|
||||
@@ -335,6 +339,7 @@ class User(Base):
|
||||
status = yield self.spawner.poll()
|
||||
if status is None:
|
||||
yield self.spawner.stop()
|
||||
self.spawner.clear_state()
|
||||
self.state = self.spawner.get_state()
|
||||
self.last_activity = datetime.utcnow()
|
||||
self.server = None
|
||||
|
Reference in New Issue
Block a user