Skip to content

Commit

Permalink
Fix abandoned runs deleted while written (#298)
Browse files Browse the repository at this point in the history
* fix runs being deleted while written

* fix runs being deleted while written
  • Loading branch information
cfuselli committed Dec 15, 2023
1 parent fbea20c commit 2ad9ecb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion amstrax/auto_processing/copy_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_rundocs(runsdb, args):

base_query = {
# end is at least 1 second ago
'end': {'$lt': datetime.datetime.now() - datetime.timedelta(seconds=1)},
'end': {'$lt': datetime.datetime.now() - datetime.timedelta(seconds=30)},
'number': {'$gt': args.min_run_number},
'data': {
'$elemMatch': {
Expand Down
4 changes: 4 additions & 0 deletions amstrax/auto_processing/delete_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def get_old_runs(runsdb, days, args):
"""
cutoff_date = datetime.datetime.now() - datetime.timedelta(days=days)
query = {
# always make sure we do not mess with data currentrly being written
'end': {'$lt': datetime.datetime.now() - datetime.timedelta(seconds=30)},
'$or': [
{'end': {'$lte': cutoff_date},
'data': {'$all': [
Expand All @@ -45,6 +47,8 @@ def get_old_runs(runsdb, days, args):

if args.only_stoomboot and not args.production:
query = {
# always make sure we do not mess with data currentrly being written
'end': {'$lt': datetime.datetime.now() - datetime.timedelta(seconds=30)},
'$or': [
{'end': {'$lte': cutoff_date},
'data': {'$all': [
Expand Down

0 comments on commit 2ad9ecb

Please sign in to comment.