-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revamp configuration loading #270
Conversation
Proselint found issuesREADME.md
doc/parameters.md
Spell Checker found issuesREADME.md
doc/parameters.md
Spell Checker found issuesREADME.md
doc/parameters.md
Generated by 🚫 Danger |
apicast/src/configuration_store.lua
Outdated
@@ -16,9 +15,18 @@ local mt = { __index = _M } | |||
|
|||
function _M.new() | |||
return setmetatable({ | |||
-- services hashed by id, example: { | |||
-- ["16"] = service1 | |||
-- } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of comments are very helpful :) 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Wanted to do it just for sake of having it written when I was changing the data structure :)
Will try to do that more in complicated cases.
e24d78e
to
6bdd136
Compare
e6db6c5
to
1cbc85b
Compare
Generally speaking we should be fine with the configuration not being immediate as long as there is a mechanism to trigger the immediate reload manually -- waiting up to 5 minutes for the configuration to be reloaded doesn't really make sense in tests. I will let @mijaros confirm this since I'm still a bit out of picture after rejoining the team. though |
Ok. We could:
|
print which configuration loader is being used
with APICAST_CONFIGURATION_CACHE
by APICAST_CONFIGURATION_LOADER
1cbc85b
to
01877bc
Compare
rather return stale configuration than nothing if services takes longer than expected to refresh it is better to return stale config than an error
into own module for reuse
wait for up to 15 seconds to load configuration for the same host
closes #230
Breaking Change
Accidentally previous APIcast would try to lazy load configuration even in the production mode.
That means that newly started APIcast would fetch configuration for service 1.
When receiving request for service 1 it would use the downloaded configuration.
But when receiving configuration of non existing service, it would try to lazy lookup the configuration and it would access the remote API.
This is "fixed" in this branch and when APIcast is in boot mode it won't lazy load configuration, ever.
This could break @3scale/qe workflow when publishing production service and immediately trying production APIcast. Because it would not have to be reloaded in up to 5 minutes.
Environment variables
This PR removes:
And adds:
APICAST_CONFIGURATION_LOADER
Can be set either to
boot
orlazy
.Boot will load configuration on boot or exit if there are any errors (but empty configuration will work).
Lazy will try to load configuration on incoming request.
APICAST_CONFIGURATION_CACHE
Controls for how long (in seconds) the configuration will be stored. Can be set to 0 for not caching it at all.
Default is empty value which will cache it forever.