LG-9449: Implement and configure ArcGIS API token refresh job#8692
Merged
LG-9449: Implement and configure ArcGIS API token refresh job#8692
Conversation
changelog: Internal, In-person proofing, Refresh ArcGIS token in job
6c24270 to
7e41b24
Compare
Contributor
|
LGTM - Code is well tested, code comments are helpful, refresh enabled defaults to false except for in production |
gina-yamada
approved these changes
Jun 29, 2023
Comment on lines
+172
to
+178
| arcgis_token: (if IdentityConfig.store.arcgis_api_refresh_token_job_enabled | ||
| { | ||
| class: 'ArcgisTokenJob', | ||
| cron: IdentityConfig.store.arcgis_api_refresh_token_job_cron, | ||
| } | ||
| end), | ||
| }.compact |
Contributor
There was a problem hiding this comment.
two ideas:
- what if we broke this into a second statement to avoid some goofy indentation here?
- what if we used
.select(&:present?)
Suggested change
| arcgis_token: (if IdentityConfig.store.arcgis_api_refresh_token_job_enabled | |
| { | |
| class: 'ArcgisTokenJob', | |
| cron: IdentityConfig.store.arcgis_api_refresh_token_job_cron, | |
| } | |
| end), | |
| }.compact | |
| } | |
| if IdentityConfig.store.arcgis_api_refresh_token_job_enabled | |
| config.good_job.cron[:arcgis_token] = { | |
| class: 'ArcgisTokenJob', | |
| cron: IdentityConfig.store.arcgis_api_refresh_token_job_cron, | |
| } | |
| end |
Suggested change
| arcgis_token: (if IdentityConfig.store.arcgis_api_refresh_token_job_enabled | |
| { | |
| class: 'ArcgisTokenJob', | |
| cron: IdentityConfig.store.arcgis_api_refresh_token_job_cron, | |
| } | |
| end), | |
| }.compact | |
| arcgis_token: { | |
| class: 'ArcgisTokenJob', | |
| cron: IdentityConfig.store.arcgis_api_refresh_token_job_cron, | |
| } && IdentityConfig.store.arcgis_api_refresh_token_job_enabled, | |
| }.select(&:present?) |
Contributor
Author
There was a problem hiding this comment.
I was deliberately trying to avoid the second statement you mentioned, though I agree the indentation is goofy.
The .select(&:present?) looks easier to understand, but it doesn't appear to work as shown based on my testing in the Rails console.
Contributor
There was a problem hiding this comment.
ah whoops yes it's this:
> { a: false, b: 1 }.select { |_k, v| v.present? }
=> {:b=>1}
Merged
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.
🎫 Ticket
🛠 Summary of changes
This intentionally excludes the retry and sliding window logic that was attempted in #8662 and #8579. These features can help with availability, but they contribute enough complexity that it doesn't make sense to shoehorn them into the same story.
📜 Testing Plan
Provide a checklist of steps to confirm the changes.