fix(proxy): return implementing modules in the system's module order (PPT-2816) - #172
Merged
Merged
Conversation
system.implementing(interface) walked the redis hash that maps module names to ids and returned modules in that hash's order. The hash has no defined order, and core rewrites it on every system update, so two overlapping updates left it in an arbitrary order. Drivers that take the first or second implementer (the mailers do) then picked the wrong module: on HIO UAT the visitor mailer sent through the Calendar module and the Template Mailer forwarded to itself. The system model now carries its module id list and implementing sorts by it, so the first result is the module listed first on the system. Modules not on the list follow in name and index order. all(name) is sorted by index for the same reason. PPT-2816
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.
What
system.implementing(interface)walked the redis hash that maps a system's module names to ids and returned modules in that hash's order. The hash has no defined order and core rewrites it on every system update. On HIO UAT on 24 Sep two overlapping updates of one system left it with the Calendar module ahead of the mailers, and every driver that takes the first Mailer implementer (fourteen of them) sent through Calendar, while the Template Mailer, which took the second, forwarded to itself until core was OOM killed.DriverModel::ControlSystemnow carries the system'smoduleslist, which core already includes in the system payload, andimplementingsorts its results by position in that list. Modules not on the list follow in name and index order.all(name)is sorted by index for the same reason. The first result is now the module an administrator listed first on the system, whatever order the hash is in.For a remote system
configis fetched once per proxy, the same requestsystem.nameand friends already make.Testing
spec/drivers_proxy_spec.cr: the hash is written in one order, the system lists another, andimplementingfollows the system.Related
PPT-2816