* perf: Reduce penalty for lack of redis connection
If redis isn't running than this client cache is slower than default
implementation because of the extra locking overhead.
* test: update perf redis counts
* perf: cache table columns in client-cache
* fix: race condition on cache-client_cache init
Rare but apparant in synthetic benchmarks.
Cache is set but client cache is still being initialized then request
will fail.
* perf: Don't run notifications when loading document
WHAT?
* fix: use cached doc to repopulate
* perf: reduce get_meta calls
These are deletes that aren't user triggered and these documents are
typically never "linked" somewhere else. So skip all expensive link /
dynamic link checks.
* perf: Reduce impact of forced cache replacement on every doc access
* fix: clear cache before processing users
Note: This is just an artifact of testing model, this won't have any real
effect on execution in real system.
Basically `enqueue_on_commit` is not respected in tests and it can't be
practically supported either.
Moved index from doctype to docname. Docname always has higher
cardinality. Even if you filter by both it shouldn't matter as
cross-doctype name conflicts are rather rare.
Perf impact of this change should be net 0 but it does addresses problem
of indeterministic load times based on how many errors exist in db.
closes https://github.com/frappe/frappe/issues/28713
* test: fix universal type checker based on downstream use and more testing
* fix: type validation error reporting
* fix: types; various
* chore: switch off test-time type checking
still too many errors
* fix: meta
* fix: test case
save is required:
1. Fetch values
```python
def get_invalid_links(self, is_submittable=False):
"""Return list of invalid links and also update fetch values if not set."""
...
```
2. Is triggered by
```python
def _validate_links(self):
if self.flags.ignore_links or self._action == "cancel":
return
...
```
3. Which is triggered by either `_save` or `insert`
----
`reload` does not trigger link fetch
```python
def reload(self) -> "Self":
"""Reload document from database"""
return self.load_from_db()
```
Neither does the new calling path which does not excempt Document
from caching when initializing meta.
It can be proven that this revert would be an alternative fix. But this
seems design by accident and there's no preceivable reason to excempt
Document args from being cached normally.
diff --git a/frappe/model/meta.py b/frappe/model/meta.py
index c4321f0128..87452c812c 100644
--- a/frappe/model/meta.py
+++ b/frappe/model/meta.py
@@ -70,11 +70,10 @@ def get_meta(doctype: str | dict | DocRef, cached=True) -> "_Meta":
Returns:
Meta object for the given doctype.
"""
- if cached and (
- doctype_name := getattr(doctype, "doctype", doctype)
- if not isinstance(doctype, dict)
- else doctype.get("doctype")
- ):
+ if cached and not isinstance(doctype, Document):
+ doctype_name = (
+ getattr(doctype, "doctype", doctype) if not isinstance(doctype, dict) else doctype.get("doctype")
+ )
if meta := frappe.cache.hget("doctype_meta", doctype_name):
return meta
Therefore, we comply the test.
* chore: feedback doctype no longer exists
missed from https://github.com/frappe/frappe/pull/17479
* chore: remove unused communication type
This was removed and migrated already in v12:
```
frappe/patches/v12_0/setup_comments_from_communications.py: frappe.db.delete("Communication", {"communication_type": "Comment"})
```
... comming from 41d90fa6d1
which effectively reverted 465318878e