ensure log level for workers gets updated

This commit is contained in:
Izalia Mae 2024-08-26 22:23:04 -04:00
parent 0576933b16
commit cff3bc30b8
3 changed files with 9 additions and 6 deletions

View file

@ -141,6 +141,7 @@ class Connection(SqlConnection):
return self.execute("SELECT * FROM inboxes WHERE accepted = 1").all(schema.Instance) return self.execute("SELECT * FROM inboxes WHERE accepted = 1").all(schema.Instance)
# todo: check if software is different than stored row
def put_inbox(self, def put_inbox(self,
domain: str, domain: str,
inbox: str | None = None, inbox: str | None = None,

View file

@ -276,7 +276,10 @@ class Config(View):
raise HttpError(400, 'Invalid key') raise HttpError(400, 'Invalid key')
with self.database.session() as conn: with self.database.session() as conn:
conn.put_config(data['key'], data['value']) value = conn.put_config(data['key'], data['value'])
if data['key'] == 'log-level':
self.app.workers.set_log_level(value)
return Response.new({'message': 'Updated config'}, ctype = 'json') return Response.new({'message': 'Updated config'}, ctype = 'json')
@ -288,7 +291,10 @@ class Config(View):
raise HttpError(400, 'Invalid key') raise HttpError(400, 'Invalid key')
with self.database.session() as conn: with self.database.session() as conn:
conn.put_config(data['key'], ConfigData.DEFAULT(data['key'])) value = conn.put_config(data['key'], ConfigData.DEFAULT(data['key']))
if data['key'] == 'log-level':
self.app.workers.set_log_level(value)
return Response.new({'message': 'Updated config'}, ctype = 'json') return Response.new({'message': 'Updated config'}, ctype = 'json')

View file

@ -118,10 +118,6 @@ class PushWorkers(list[PushWorker]):
self._count: int = count self._count: int = count
def push_item(self, item: QueueItem) -> None:
self.queue.put(item)
def push_message(self, inbox: str, message: Message, instance: Instance) -> None: def push_message(self, inbox: str, message: Message, instance: Instance) -> None:
self.queue.put(PostItem(inbox, message, instance)) self.queue.put(PostItem(inbox, message, instance))