Repository navigation
Conversation
…e limit The "offload limit reached" flag was set by the upload check and cleared only when a bulk offload started, so the warning stayed after the account usage dropped (for example after duplicate sites were removed). It also silently stopped new uploads from offloading. - The daily sync stores the account's offload limit and clears the flag when the account is below it again. - The upload check stores the account limit with the flag, so the warning no longer shows the 50,000 default. - The upload check counts the images still to upload only while a bulk offload runs. The progress of a finished offload or of a rollback (which records how many images it moves back) no longer counts toward the limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue: #1118
The "offload limit reached" warning stayed after the account usage dropped, with the 50,000 default as the limit. The flag behind it was only cleared when a bulk offload started, and while it was set new uploads silently stopped being offloaded. The daily sync now reconciles it with the account usage.
What changed
Optml_Admin::daily_sync()— the account details already includeoffload_limitandoffloaded_images. The sync stores the limit, and clears the flag when the account is below it.Optml_Media_Offload::generate_image_meta())optml_process_meta"remaining") only while a bulk offload runs.move_images()records "remaining" for rollbacks too, and it stays after a run, so after a large rollback a single upload could set the flag although the account was far below the limit.Note
If the account really is at its limit, the next upload sets the flag again (preflight or upload exception), so clearing it daily cannot hide a real limit for long.
Tests
tests/test-offload-limit-sync.php(new): the daily sync clears the warning and stores the limit when usage is below it, keeps it at the limit, and changes nothing without usage details.tests/test-media.php: stale rollback progress does not trip the limit (the upload is offloaded); during a bulk offload the check still trips and stores the account limit.development. Mutations (<=instead of<, limit not stored by the sync or the check, stale "remaining" counted) each fail a test.QA
On a connected site, trigger the warning (or set the
offload_limit_reachedsetting toenabledwith WP-CLI:wp eval '( new Optml_Settings() )->update( "offload_limit_reached", "enabled" );').Run the daily sync:
wp cron event run optml_daily_sync.Expect: in
WP Admin → Optimole → Settings → Image Storage, the limit warning is gone, and a new upload is offloaded.Verification (head
a9fcc18f)tests/test-media.phpandtests/test-offload-limit-sync.php, each run alonephpcs,phpstan(build-only include errors excluded locally; CI builds assets first)Not proven
🤖 Generated with Claude Code