Merge pull request #27100 from gavindsouza/misc-fixes-12_07_24
fix: Misc fixes
This commit is contained in:
commit
f2d418ce43
4 changed files with 6 additions and 10 deletions
|
|
@ -93,6 +93,7 @@ def enqueue_create_notification(users: list[str] | str, doc: dict):
|
|||
doc=doc,
|
||||
users=users,
|
||||
now=frappe.flags.in_test,
|
||||
enqueue_after_commit=not frappe.flags.in_test,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ class Document(BaseDocument):
|
|||
d: Document
|
||||
d.db_update()
|
||||
|
||||
def get_doc_before_save(self) -> "Document":
|
||||
def get_doc_before_save(self) -> "Self":
|
||||
return getattr(self, "_doc_before_save", None)
|
||||
|
||||
def has_value_changed(self, fieldname):
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ def enqueue(
|
|||
|
||||
def enqueue_call():
|
||||
return q.enqueue_call(
|
||||
execute_job,
|
||||
"frappe.utils.background_jobs.execute_job",
|
||||
on_success=Callback(func=on_success) if on_success else None,
|
||||
on_failure=Callback(func=on_failure) if on_failure else None,
|
||||
timeout=timeout,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
# License: MIT. See LICENSE
|
||||
import pickle
|
||||
import re
|
||||
from contextlib import suppress
|
||||
|
||||
import redis
|
||||
from redis.commands.search import Search
|
||||
|
|
@ -62,14 +63,8 @@ class RedisWrapper(redis.Redis):
|
|||
if not expires_in_sec:
|
||||
frappe.local.cache[key] = val
|
||||
|
||||
try:
|
||||
if expires_in_sec:
|
||||
self.setex(name=key, time=expires_in_sec, value=pickle.dumps(val))
|
||||
else:
|
||||
self.set(key, pickle.dumps(val))
|
||||
|
||||
except redis.exceptions.ConnectionError:
|
||||
return None
|
||||
with suppress(redis.exceptions.ConnectionError):
|
||||
self.set(name=key, value=pickle.dumps(val), ex=expires_in_sec)
|
||||
|
||||
def get_value(self, key, generator=None, user=None, expires=False, shared=False):
|
||||
"""Return cache value. If not found and generator function is
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue