Skip to content

[fix] don't remove cache on complete, instead use scheduled cleaners#4078

Merged
zsculac merged 7 commits intov8/developfrom
feature/improve-publish-success-rate
Dec 15, 2025
Merged

[fix] don't remove cache on complete, instead use scheduled cleaners#4078
zsculac merged 7 commits intov8/developfrom
feature/improve-publish-success-rate

Conversation

@lupuszr
Copy link
Collaborator

@lupuszr lupuszr commented Dec 15, 2025

the cache cleaner now runs every 1h but frees only from memory, for disk it waits for 24h as before


Note

Retains operation cache on completion while introducing hourly memory cleanup (24h for files), footprint logging, and supporting unit tests.

  • Cache handling:
    • operation-service: markOperationAsCompleted now accepts options.reuseExistingCache to avoid rewriting file cache; updates status earlier.
    • publish-service: on min replication, reuses existing cached data and completes with { reuseExistingCache: true }.
  • Cleanup scheduling:
    • constants: add OPERATION_ID_MEMORY_CLEANUP_TIME_MILLS (1h); keep OPERATION_ID_COMMAND_CLEANUP_TIME_MILLS (24h) for files.
    • operation-id-cleaner-command: run every 1h; clean memory with 1h TTL and files with 24h TTL.
  • Observability:
    • operation-id-cleaner-command: logs pre-clean cache footprint (memory/files) with graceful error handling.
    • operation-id-service: add getOperationIdMemoryCacheSizeBytes() and getOperationIdFileCacheSizeBytes().
  • Tests:
    • Add unit tests for cleaner behavior and file cache TTL deletion.

Written by Cursor Bugbot for commit eef936b. This will update automatically on new commits. Configure here.

the cache cleaner now runs every 1h but frees only from memory, for disk
it waits for 24h as before
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on January 7

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

null,
cachedData,
this.completedStatuses,
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: UpdateService still removes cache on complete unlike PublishService

The PR's intent is to "don't remove cache on complete, instead use scheduled cleaners" as stated in the title. PublishService was updated to retrieve and preserve cached data when calling markOperationAsCompleted. However, UpdateService.processResponse still passes null to markOperationAsCompleted at line 79, which causes active cache removal on update completion. Since UpdateService has a nearly identical pattern to PublishService (both cache user-submitted data and replicate to the network), this appears to be an incomplete implementation of the stated fix.

Fix in Cursor Fix in Web


const fileList = await this.fileService.readDirectory(cacheFolderPath);
let total = 0;
for (const fileName of fileList) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can speed this up with Promise.all

Comment on lines 72 to 75
} else {
await this.operationIdService.cacheOperationIdDataToMemory(operationId, responseData);
await this.operationIdService.cacheOperationIdDataToFile(operationId, responseData);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are passing data we read from cache as responseData, why do we want to cache it again? Seems wasteful, perhaps we can remove this. Or split into 2 separate functions like we talked about

@zsculac
Copy link
Collaborator

zsculac commented Dec 15, 2025

Don't forget to increase the version in package.json and package-lock.json

@lupuszr lupuszr force-pushed the feature/improve-publish-success-rate branch from cb4043f to 7850caf Compare December 15, 2025 11:32
@zsculac zsculac merged commit 87ceab8 into v8/develop Dec 15, 2025
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants