-
-
Notifications
You must be signed in to change notification settings - Fork 528
[19.0] [MIG] queue_job: migrate + tests #840
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
base: 19.0
Are you sure you want to change the base?
Changes from all commits
2a5ccb8
ce67593
b283cd8
df50b83
b7129d7
ac812d7
a7d4364
4da9fae
f494bcc
3b733f1
ee67632
d827d58
9aeebee
9ac6b25
99cc44f
211e467
620413a
82d62a1
81a1488
6d330f2
f685d12
d27f83d
8dd4af0
231705d
9ea78c5
038c334
96a9ada
afc9c76
f947199
c30bf4b
123900c
d25ff12
754e438
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -472,11 +472,12 @@ def from_environ_or_config(cls): | |
| return runner | ||
|
|
||
| def get_db_names(self): | ||
| if config["db_name"]: | ||
| db_names = config["db_name"].split(",") | ||
| else: | ||
| db_names = odoo.service.db.list_dbs(True) | ||
| return db_names | ||
| db_name_opt = config["db_name"] | ||
| if db_name_opt: | ||
| if isinstance(db_name_opt, (list, tuple, set)): | ||
| return list(db_name_opt) | ||
| return [n for n in str(db_name_opt).split(",") if n] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does any one know in which case |
||
| return odoo.service.db.list_dbs(True) | ||
|
|
||
| def close_databases(self, remove_jobs=True): | ||
| for db_name, db in self.db_by_name.items(): | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -193,9 +193,17 @@ def foo_job_options(self, arg1): | |||||
| } | ||||||
|
|
||||||
| def _register_hook(self): | ||||||
| self._patch_method( | ||||||
| # patch the method at registry time | ||||||
| patched = self._patch_job_auto_delay( | ||||||
| "foo", context_key="auto_delay_foo" | ||||||
| ) | ||||||
| setattr( | ||||||
| type(self), | ||||||
| "foo", | ||||||
| self._patch_job_auto_delay("foo", context_key="auto_delay_foo") | ||||||
| functools.update_wrapper( | ||||||
| patched, | ||||||
| getattr(type(self), "foo"), | ||||||
| ), | ||||||
| ) | ||||||
| return super()._register_hook() | ||||||
|
|
||||||
|
|
@@ -224,8 +232,9 @@ def auto_delay_wrapper(self, *args, **kwargs): | |||||
| delayed = self.with_delay(**job_options) | ||||||
| return getattr(delayed, method_name)(*args, **kwargs) | ||||||
|
|
||||||
| origin = getattr(self, method_name) | ||||||
| return functools.update_wrapper(auto_delay_wrapper, origin) | ||||||
| origin_func = getattr(type(self), method_name) | ||||||
| auto_delay_wrapper.origin = origin_func | ||||||
| return functools.update_wrapper(auto_delay_wrapper, origin_func) | ||||||
|
|
||||||
| @api.model | ||||||
| def _job_store_values(self, job): | ||||||
|
|
@@ -260,11 +269,5 @@ def _job_prepare_context_before_enqueue(self): | |||||
| if key in self._job_prepare_context_before_enqueue_keys() | ||||||
| } | ||||||
|
|
||||||
| @classmethod | ||||||
| def _patch_method(cls, name, method): | ||||||
| origin = getattr(cls, name) | ||||||
| method.origin = origin | ||||||
| # propagate decorators from origin to method, and apply api decorator | ||||||
| wrapped = api.propagate(origin, method) | ||||||
| wrapped.origin = origin | ||||||
| setattr(cls, name, wrapped) | ||||||
| # Note: no local _patch_method helper; if needed, patch methods | ||||||
| # directly in _register_hook as shown above. | ||||||
|
Comment on lines
+272
to
+273
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Nit: this comment is not really helpful outside the migration PR. |
||||||
Uh oh!
There was an error while loading. Please reload this page.