Skip to content

Commit faac6ae

Browse files
committed
Formatting in scheduled_jobs.py
1 parent 467a1d8 commit faac6ae

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

opentakserver/blueprints/scheduled_jobs.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,19 +306,25 @@ def delete_old_data():
306306
body=json.dumps(
307307
{"cot": tostring(cot).decode("utf-8"), "uid": app.config["OTS_NODE_ID"]}
308308
),
309-
properties=pika.BasicProperties(expiration=app.config.get("OTS_RABBITMQ_TTL")),
309+
properties=pika.BasicProperties(
310+
expiration=app.config.get("OTS_RABBITMQ_TTL")
311+
),
310312
)
311313
channel.basic_publish(
312314
exchange="firehose",
313315
routing_key="",
314316
body=json.dumps(
315317
{"cot": tostring(cot).decode("utf-8"), "uid": app.config["OTS_NODE_ID"]}
316318
),
317-
properties=pika.BasicProperties(expiration=app.config.get("OTS_RABBITMQ_TTL")),
319+
properties=pika.BasicProperties(
320+
expiration=app.config.get("OTS_RABBITMQ_TTL")
321+
),
318322
)
319323
db.session.delete(marker)
320324

321-
alerts = db.session.execute(db.session.query(Alert).where(Alert.start_time <= timestamp)).all()
325+
alerts = db.session.execute(
326+
db.session.query(Alert).where(Alert.start_time <= timestamp)
327+
).all()
322328
for alert in alerts:
323329
alert = alert[0]
324330
cot = generate_delete_cot(alert.uid, alert.cot.type)
@@ -376,6 +382,9 @@ def delete_old_data():
376382
weeks=app.config.get("OTS_DELETE_OLD_DATA_WEEKS"),
377383
)
378384

385+
db.session.execute(delete(MissionRole).where(MissionRole.createTime <= timestamp))
386+
db.session.execute(delete(MissionUID).where(MissionUID.timestamp <= timestamp))
387+
db.session.execute(delete(MissionChange).where(MissionChange.timestamp <= timestamp))
379388
db.session.execute(delete(EUD).where(EUD.last_event_time <= timestamp))
380389
db.session.execute(delete(Point).where(Point.timestamp <= timestamp))
381390
db.session.execute(delete(CoT).where(CoT.timestamp <= timestamp))

0 commit comments

Comments
 (0)