Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 4732039

Browse files
fix: remove process flakes commit_sha arg (#1199)
1 parent 17c8fb5 commit 4732039

1 file changed

Lines changed: 9 additions & 25 deletions

File tree

tasks/process_flakes.py

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Any, Literal
2+
from typing import Any, Literal, cast
33

44
from redis import Redis
55
from redis.exceptions import LockError
@@ -21,21 +21,12 @@
2121
OLD_KEY = "flake_uploads:{}"
2222

2323

24-
def get_redis_val(redis_client: Redis, repo_id: int) -> tuple[list[bytes], bool]:
25-
commit_ids = redis_client.lpop(NEW_KEY.format(repo_id), 10)
24+
def get_redis_val(redis_client: Redis, repo_id: int) -> list[bytes]:
25+
commit_ids = cast(list[bytes], redis_client.lpop(NEW_KEY.format(repo_id), 10))
2626
if commit_ids is None:
2727
commit_ids = []
2828

29-
current_commit = False
30-
with redis_client.pipeline() as pipe:
31-
# can't use getdel because the value of the key is not a string
32-
pipe.get(OLD_KEY.format(repo_id))
33-
pipe.delete(OLD_KEY.format(repo_id))
34-
commit_id = pipe.execute()
35-
if commit_id[0] is not None:
36-
current_commit = True
37-
38-
return commit_ids, current_commit
29+
return commit_ids
3930

4031

4132
class ProcessFlakesTask(BaseCodecovTask, name=process_flakes_task_name):
@@ -48,7 +39,6 @@ def run_impl(
4839
_db_session: Session,
4940
*,
5041
repo_id: int,
51-
commit_id: str,
5242
impl_type: Literal["old", "new", "both"] = "old",
5343
**kwargs: Any,
5444
):
@@ -75,10 +65,7 @@ def run_impl(
7565
The locking scheme is set up such that no upload will be unprocessed. Before queuing up the process flakes task the
7666
test results finisher and sync pulls tasks will set the flake_uploads key in redis for that repo.
7767
"""
78-
log.info(
79-
"Received process flakes task",
80-
extra=dict(repoid=repo_id, commit=commit_id),
81-
)
68+
log.info("Received process flakes task")
8269

8370
if impl_type == "new" or impl_type == "both":
8471
process_flakes_for_repo(repo_id)
@@ -97,15 +84,12 @@ def run_impl(
9784
blocking_timeout=3,
9885
):
9986
while True:
100-
commit_ids, current_commit = get_redis_val(redis_client, repo_id)
101-
if not commit_ids and not current_commit:
87+
commit_shas = get_redis_val(redis_client, repo_id)
88+
if not commit_shas:
10289
break
10390

104-
for commitid in commit_ids:
105-
process_func(repo_id, commitid.decode())
106-
107-
if current_commit:
108-
process_func(repo_id, commit_id)
91+
for commit_sha in commit_shas:
92+
process_func(repo_id, commit_sha.decode())
10993

11094
except LockError:
11195
log.warning("Unable to acquire process flakeslock for key %s.", lock_name)

0 commit comments

Comments
 (0)