Repository navigation
Fix delivery behavior issues from code review - #580
Merged
Merged
Conversation
* EventJob loads notifications with find_in_batches and enqueues delivery jobs with ActiveJob.perform_all_later (per-job enqueue on Rails 7.0) via a new DeliverBy#job primitive * iOS opens one Apnotic connection per delivery and closes it afterwards instead of a class-level pool whose on(:error) handler was bound to the first job instance and whose credentials were shared across notifiers. PR #503 already closed the connection after every push, so the pool was not pooling anything. Removes the pool_size option. * FCM only treats a 400 as an invalid token when the error names message.token or mentions the registration token, so malformed payloads no longer trigger invalid_token cleanup. Access token fetched once per delivery instead of once per device token. * post_request no longer logs request/response bodies (Bluesky's session request carries the password and its response carries JWTs)
* FCM bad_token? uses a single detection strategy (error message) with a token_error? explaining method, same shape as the iOS check * EventJob pulls the per-notification job building into delivery_jobs_for so perform reads top to bottom * iOS error_handler uses truthiness like invalid_token * iOS test fakes Apnotic::Connection instead of reaching into @client
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.
Summary
Follow-up to #579 covering the review items that change delivery behavior.
EventJobloads notifications withfind_in_batchesand enqueues delivery jobs in bulk withActiveJob.perform_all_later(falls back to per-jobenqueueon Rails 7.0). AddsDeliverBy#jobas the primitive;perform_lateris nowjob(...).enqueue. Note:perform_all_laterskips ActiveJob enqueue callbacks (documented Rails behavior); noted in the CHANGELOG.Apnotic::Connectionper delivery, closed inensure. The class-level pool'son(:error)closure captured the first job instance, so later notifications'error_handlerran against the wrong notification, and every notifier shared the first one's credentials. Since IOS Delivery Method error handling #503 already closed the connection after every push, the pool wasn't pooling anything. Removespool_size.message.tokenor mentions the registration token. Previously any 400 (e.g. a malformed payload) invokedinvalid_tokenand could delete valid tokens. Access token fetched once per delivery rather than once per device token.post_requestno longer logs request/response bodies — Bluesky'screateSessionrequest contains the password and the response contains access/refresh JWTs.Test plan
standardrbcleanrails teston main Gemfile, Rails main, 7.1, 8.1 — 147 runs, 0 failuresjobs.each(&:enqueue)fallback