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

Commit b112e47

Browse files
committed
fix: remove process flakes commit_sha arg
this is the final step in moving the process flakes task to using the new method of fetching commit shas from redis. Since all TA finisher tasks are writing to redis using the new method, the process flakes task doesn't need to read the old method anymore, so we can remove that.
1 parent ad52223 commit b112e47

1 file changed

Lines changed: 9 additions & 22 deletions

File tree

tasks/process_flakes.py

Lines changed: 9 additions & 22 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
):
@@ -77,7 +67,7 @@ def run_impl(
7767
"""
7868
log.info(
7969
"Received process flakes task",
80-
extra=dict(repoid=repo_id, commit=commit_id),
70+
extra=dict(repoid=repo_id),
8171
)
8272

8373
if impl_type == "new" or impl_type == "both":
@@ -97,15 +87,12 @@ def run_impl(
9787
blocking_timeout=3,
9888
):
9989
while True:
100-
commit_ids, current_commit = get_redis_val(redis_client, repo_id)
101-
if not commit_ids and not current_commit:
90+
commit_shas = get_redis_val(redis_client, repo_id)
91+
if not commit_shas:
10292
break
10393

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)
94+
for commit_sha in commit_shas:
95+
process_func(repo_id, commit_sha.decode())
10996

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

0 commit comments

Comments
 (0)