* 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
* perf: resolve rounding method once
When rounding method is explcitly specified it's 1.4x faster.
* perf: reorder checks
Bankers rounding is default and most common now
* perf: speedup get_system_settings
`get_doc` is single most used commands, directly and indirectly.
Currently there's QB overhead of building queries.
These queries are SO SIMPLE, I don't believe we need QB to keep these
maintainable or compatible with databases.
Microbenchmarks (first is simple flat document, second has many child tables):
```
bench_orm_bench_get_doc: Mean +- std dev: [before] 10.7 ms +- 0.2 ms -> [after] 7.24 ms +- 0.15 ms: 1.48x faster
bench_orm_bench_get_user: Mean +- std dev: [before] 16.3 ms +- 0.2 ms -> [after] 9.50 ms +- 0.14 ms: 1.72x faster
```
* fix: Apply read_only_method decorator to Document methods
* fix: update tests for read-only document context manager
* refactor: place mappers into read-only mode
Reapply "refactor: place mappers into read-only mode"
This reverts commit a8208d57069c63f0982bf2881bcad28a4b349f3c.
read-only mode is now thread safe
* refactor: improve maintainability with a simple dispatcher
* refactor: improve maintainability with a init dispatcher on Document
* refactor: improve maintainability with an init dispatcher on meta
Generator within generator caused something funky to happen which meant wrong values being stitched together as one document, sometimes(?)
Via https://github.com/frappe/frappe/pull/22114
- Scheduled Job sync when type was changed from scheduled to some other
type didn't work.
- It updates on every save with message, bad DX IMO (can't save script
and edit without dismissing)
- This was because of complex walrus which was triggering rest of code
even when nothing changed. Maybe walrus opponents were onto something.
- `Truthy` couples two different operations and hence makes code
complicated. In most cases where these checks are required it's not
performance critical, we can do 1 more function call to avoid this
coupling of change + actual value.
doing explicit transition check for discard because,
* there's only one transition check that is required
* draft(0) > cancelled(2) and submitted(1) > cancelled(2) are valid
checkes for save so it doesn't make sense editing
check_docstatus_transition
- Events like doc.save and doc.submit need to be atomic
- Document hooks can make it not so atomic.
This is extending server script behaviour where server script hooks are
not allowed to commit/rollback.