Closed agritheory closed 5 months ago
@fproldan Do you think we should have this function like this programmatically, where the Shipstation Settings object modifies frappe.conf
?
@agritheory
The frappe.conf
could be edited programmatically, I'm not sure if we can do the same for the bench setup supervisor
part.
import os
sites_path = os.getcwd()
common_site_config_path = os.path.join(sites_path, 'common_site_config.json')
workers = frappe.conf.workers
if workers:
workers['shipstation'] = {'timeout': 8000}
else:
workers = {'shipstation': {'timeout': 8000}}
update_site_config('workers', workers, validate=False, site_config_path=common_site_config_path)
Another option that comes to mind is to allow to configure a custom queue name in Shipstation Settings and we use that one in our enqueue
using long
as a fallback if it's not configured, but the setup part of adding the queue should be mane manually.
So Frappe does the supervisor config programmatically, I think it makes sense to configure this in an after_install
hook or a patch. Given that we'll be reusing this approach in a couple of different apps, I think it would be good to establish a reliable pattern for configuring it.
@agritheory
To add a custom queue we need to edit the
common_site_config.json
by adding theworkers
key, for instance:This will require running
bench setup production
orbench setup supervisor
to thesupervisor.conf
file to be updated.Then we need to edit the desired
frappe.enqueue
to use that queue instead of long:I think that given it's a per bench/server configuration we need to find a way to make the usage of a custom queue configurable.