Saving settings model restarts queue workers #221
ericp-mrel
started this conversation in
Ideas
Replies: 1 comment
-
I would probably recommend using a different way to store this information, probably the Cache system would be my recommendation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an website I built that makes heavy use of queued jobs and workers in order to process thousands of record updates. The data is received from a 3rd party API and they use a updated_at timestamp in order to track which records have already been received and so they know what new records need to be sent to you which have been updated since the last time you've called the API endpoint.
Basically, my website/application utilizes a settings model in order to track and store this API information and every time I update the settings data when I'm looping through the records received from the API it keeps restarting my queue workers until it has gone though all of the data and the queue workers are then able to finally keep processing jobs uninterrupted.
So, my question, is this really necessary in order for queue workers to receive the new settings data or can this be accomplished in a nicer way which doesn't require restarting queue workers every time settings models are updated.
Ref: https://github.com/wintercms/winter/blob/develop/modules/system/behaviors/SettingsModel.php#L205-L214
I wonder if there is a way to be able to still have singletons and not have to restart queue workers just for them to be able to get the updated data. Or, if it really would be necessary to ditch singletons in order to avoid the queue restarts.
I understand why the singletons are used since it allows you to share a single instance of the model so that everyone who has a settings model gets the updated data without having to have a different instance and re-fetch the model if it gets out of sync.
Beta Was this translation helpful? Give feedback.
All reactions