add completed_successfully column to jobs table and update related statistics
This commit is contained in:
@@ -73,6 +73,24 @@ def test_sqlite_lease_claims_one_queued_job(tmp_path) -> None:
|
||||
expires_at = datetime.fromisoformat(ready["expires_at"])
|
||||
completed_at = datetime.fromisoformat(ready["completed_at"])
|
||||
assert expires_at - completed_at <= timedelta(days=2)
|
||||
expected_stats = {
|
||||
"websites_cloned": 1,
|
||||
"bytes_scraped": 10,
|
||||
"active_crawls": 0,
|
||||
"files_archived": 1,
|
||||
}
|
||||
assert database.public_stats() == expected_stats
|
||||
|
||||
database.mark_deleted(job["id"])
|
||||
|
||||
assert database.public_stats() == expected_stats
|
||||
with database.connection() as connection:
|
||||
connection.execute(
|
||||
"UPDATE jobs SET completed_successfully = 0 WHERE id = ?",
|
||||
(job["id"],),
|
||||
)
|
||||
database.initialize()
|
||||
assert database.public_stats() == expected_stats
|
||||
|
||||
|
||||
def test_worker_cannot_cancel_without_a_user_cancellation_request(tmp_path) -> None:
|
||||
|
||||
Reference in New Issue
Block a user