Skip to content

Commit

Permalink
Rest of string ids migration (#795)
Browse files Browse the repository at this point in the history
Couple other places where we use int ids
  • Loading branch information
fkorotkov authored Sep 30, 2024
1 parent 9085845 commit 5b4e3d0
Show file tree
Hide file tree
Showing 4 changed files with 992 additions and 961 deletions.
6 changes: 4 additions & 2 deletions api/cirrus_ci_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ message QueryRunningTasksRequest {

message QueryRunningTasksResponse {
WorkerStatus status = 1;
repeated int64 running_tasks = 2;
repeated int64 old_running_tasks = 2 [deprecated = true];
repeated string running_tasks = 3;
}

message TaskFailedRequest {
Expand Down Expand Up @@ -505,7 +506,8 @@ message CacheInfo {
string key = 1;
int64 size_in_bytes = 2;
int64 creation_timestamp = 3;
int64 created_by_task_id = 4;
int64 old_created_by_task_id = 4 [deprecated = true];
string created_by_task_id = 5;
}

message CacheInfoResponse {
Expand Down
6 changes: 4 additions & 2 deletions internal/agent/http_cache/http_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ func checkCacheExists(w http.ResponseWriter, cacheKey string) {
log.Printf("%s cache info failed: %v\n", cacheKey, err)
w.WriteHeader(http.StatusNotFound)
} else {
if response.Info.CreatedByTaskId > 0 {
w.Header().Set(CirrusHeaderCreatedBy, strconv.FormatInt(response.Info.CreatedByTaskId, 10))
if response.Info.OldCreatedByTaskId > 0 {
w.Header().Set(CirrusHeaderCreatedBy, strconv.FormatInt(response.Info.OldCreatedByTaskId, 10))
} else if response.Info.CreatedByTaskId != "" {
w.Header().Set(CirrusHeaderCreatedBy, response.Info.CreatedByTaskId)
}
w.Header().Set("Content-Length", strconv.FormatInt(response.Info.SizeInBytes, 10))
w.WriteHeader(http.StatusOK)
Expand Down
2 changes: 1 addition & 1 deletion internal/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func (worker *Worker) Pause(ctx context.Context, wait bool) error {
response, err := upstream.QueryRunningTasks(ctx, &api.QueryRunningTasksRequest{})
if err != nil {
return fmt.Errorf("upstream %s failed while waiting: %w", upstream.Name(), err)
} else if len(response.RunningTasks) == 0 {
} else if len(response.RunningTasks) == 0 && len(response.OldRunningTasks) == 0 {
// done waiting for the current upstream
break
}
Expand Down
Loading

0 comments on commit 5b4e3d0

Please sign in to comment.