Skip to content

Commit

Permalink
Fix date
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimas committed May 7, 2024
1 parent 451703b commit 06a4aff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions transcribe-batch/tests/testusage.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ def test_log_rotate(self):
usage.log("conversion_error")

lines = self.readLog()
print(lines)

self.assertEqual(len(lines), 2)
self.assertEqual(len(lines), 1)

def _test_is_old_line_true(self):
usage = UsageTest()
Expand Down
5 changes: 2 additions & 3 deletions transcribe-service/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ def _is_old_line(self, line):
logging.error("Usage._is_old_line. Error:" + str(exception))
invalid = True

return invalid or line_datetime < self._get_time_now() - datetime.timedelta(
days=self.DAYS_TO_KEEP
)
now = self._get_time_now() - datetime.timedelta(days=self.DAYS_TO_KEEP)
return invalid or line_datetime.date() <= now.date()

def _rotate_file(self):
NEW = "usage.new"
Expand Down

0 comments on commit 06a4aff

Please sign in to comment.