Skip to content

Commit d072c44

Browse files
committed
Update
1 parent 90d573c commit d072c44

2 files changed

Lines changed: 17 additions & 19 deletions

File tree

controller/getchangedtargets.go

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ func (c *controller) GetChangedTargets(request *pb.GetChangedTargetsRequest, str
8989
cacheKey := common.GetComparedTargetsCachePath(request.GetFirstRevision().GetRemote(), treehash1, treehash2, request.GetRequestOptions())
9090
cachedReader, cacheErr := storage.NewChangedTargetsReader(ctx, c.storage, cacheKey)
9191
if cacheErr != nil && !storage.IsNotFound(cacheErr) {
92-
logger.Error("GetChangedTargets: failed to read from cache", zap.Error(cacheErr))
93-
return fmt.Errorf("failed to read from cache: %w", cacheErr)
92+
logger.Warn("GetChangedTargets: failed to read from cache, proceeding to compute", zap.Error(cacheErr))
9493
} else if cachedReader != nil {
9594
// Buffer all responses before sending any. A concurrent goroutine write may have
9695
// left a partial blob in storage; buffering lets us detect corruption and fall
@@ -114,25 +113,24 @@ func (c *controller) GetChangedTargets(request *pb.GetChangedTargetsRequest, str
114113
cached = append(cached, resp)
115114
}
116115
if closeErr := cachedReader.Close(); closeErr != nil {
117-
logger.Error("GetChangedTargets: failed to close cached reader", zap.Error(closeErr))
118-
return fmt.Errorf("close cached reader: %w", closeErr)
116+
logger.Warn("GetChangedTargets: failed to close cached reader", zap.Error(closeErr))
119117
}
120118

121119
if readErr != nil {
122-
logger.Error("GetChangedTargets: failed to read cached response", zap.Error(readErr))
123-
return fmt.Errorf("read cached response: %w", readErr)
124-
}
125-
cacheReadDuration := time.Since(cacheStart)
126-
scope.Counter("changed_targets_cache_hit").Inc(1)
127-
scope.Timer("cache_read_duration").Record(cacheReadDuration)
128-
if sendErr := sendTrimmedChangedTargets(stream, cached, maxDist, request.GetOutputConfig()); sendErr != nil {
129-
logger.Error("GetChangedTargets: failed to send cached response", zap.Error(sendErr))
130-
return fmt.Errorf("failed to send cached response: %w", sendErr)
120+
logger.Warn("GetChangedTargets: cached result is incomplete, recomputing", zap.Error(readErr))
121+
} else {
122+
cacheReadDuration := time.Since(cacheStart)
123+
scope.Counter("changed_targets_cache_hit").Inc(1)
124+
scope.Timer("cache_read_duration").Record(cacheReadDuration)
125+
if sendErr := sendTrimmedChangedTargets(stream, cached, maxDist, request.GetOutputConfig()); sendErr != nil {
126+
logger.Error("GetChangedTargets: failed to send cached response", zap.Error(sendErr))
127+
return fmt.Errorf("failed to send cached response: %w", sendErr)
128+
}
129+
totalDuration := time.Since(start)
130+
scope.Timer("total_duration").Record(totalDuration)
131+
scope.Histogram("total_duration.histogram", c.totalDurationBuckets).RecordDuration(totalDuration)
132+
return nil
131133
}
132-
totalDuration := time.Since(start)
133-
scope.Timer("total_duration").Record(totalDuration)
134-
scope.Histogram("total_duration.histogram", c.totalDurationBuckets).RecordDuration(totalDuration)
135-
return nil
136134
}
137135
}
138136
}

orchestrator/native_orchestrator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ func (b *nativeOrchestrator) GetTargetGraph(ctx context.Context, param GetTarget
128128
}
129129
defer func() {
130130
if releaseErr := ws.Release(); releaseErr != nil {
131-
retErr = errors.Join(retErr, fmt.Errorf("release workspace: %w", releaseErr))
131+
logger.Warnw("GetTargetGraph: failed to release workspace", zap.Error(releaseErr))
132132
if removeErr := os.RemoveAll(ws.Path()); removeErr != nil {
133-
retErr = errors.Join(retErr, fmt.Errorf("remove workspace: %w", removeErr))
133+
logger.Warnw("GetTargetGraph: failed to remove workspace", zap.Error(removeErr))
134134
}
135135
}
136136
}()

0 commit comments

Comments
 (0)