Commit graph

48396 commits

Author SHA1 Message Date
Ankush Menat
dfc6dcb6b8 Revert "perf: Avoid checking server script map (#29057)"
This reverts commit 55a55e7f7b.
2025-01-06 19:43:53 +05:30
Ankush Menat
c76b23a050 perf: cache server script map in client cache 2025-01-06 19:43:28 +05:30
Ankush Menat
7ea0421624 perf: cache system settings in client side cache 2025-01-06 19:40:07 +05:30
Ankush Menat
c14d416d19 docs: add usage / notes in code 2025-01-06 19:28:37 +05:30
Ankush Menat
15f5adc25a refactor: use namedtuple for readability 2025-01-06 19:28:33 +05:30
Ankush Menat
b51cfc1705 perf: minimize penalty for broken client cache 2025-01-06 18:57:57 +05:30
Ankush Menat
119af71ae3 refactor: variable names, force RESP2 2025-01-06 18:57:57 +05:30
Ankush Menat
98b1df7dac fix: guard all writes with an RLock 2025-01-06 18:57:57 +05:30
Ankush Menat
53f085e0f4 test: ttl and maxsize 2025-01-06 18:57:57 +05:30
Ankush Menat
55ae5615d0 fix: clear all meta cache only when doctype is not specified 2025-01-06 18:57:57 +05:30
Ankush Menat
f332852415 fix: start tracking keys set by us immediately 2025-01-06 18:57:57 +05:30
Ankush Menat
4518b4562f test: add basic client cache tests 2025-01-06 18:57:57 +05:30
Ankush Menat
8f2f94b7e5 test: make redis query count util work with any redis instance 2025-01-06 18:57:57 +05:30
Ankush Menat
f74ada155e fix: Don't serve local cache values when it becomes unhealthy 2025-01-06 18:57:57 +05:30
Ankush Menat
29733febcb refactor: minor cleanup / avoid repeat calls
This get+conditional set is also slightly prone to data races, but
doesn't seem to be harmful as of now.

Rationale:
- To enable recorder one must first send a request, so this should be
  set long before.
- While enabling we can accidentally clear cache for another worker by
  invalidating it, but that is kind of acceptable behaviour. We ONLY set
  it to False when `None` is received from Redis. Local invalidations
  remove it completely.
2025-01-06 18:57:57 +05:30
Ankush Menat
45d414fe29 refactor: per-key TTL 2025-01-06 18:57:57 +05:30
Ankush Menat
0a85992331 fix: avoid clearing client cache for single doctype
Similar to recent _SITE_CACHE change, it's not required.

Properly cleared keys will get invalidated anyway.
2025-01-06 18:57:57 +05:30
Ankush Menat
21f0cda732 refactor: Reuse original cache connection
Drops redis connection per worker from 3 to 2!

Nothing wrong with doing this.
2025-01-06 18:57:57 +05:30
Ankush Menat
01cfa647a2 fix: set/del locally too
This is required if we do NOLOOP
2025-01-06 18:57:57 +05:30
Ankush Menat
e7139a1395 perf: store meta in client cache 2025-01-06 18:57:57 +05:30
Ankush Menat
cd47bee65e fix: Avoid data races by accessing request specific cache
Imagine:
| client 1 | client 2 |
| ---      | ---      |
| rd(x)    |          |
|          |  wr(x)   |
| inv(x)   |          |
| rd(x)    |          |  <- This will end up using request specific cache!
2025-01-06 18:57:57 +05:30
Ankush Menat
764c3134cb fix: expire client cache every 10 minutes
We can be more aggressive later, this is a good starting parting.
2025-01-06 18:57:57 +05:30
Ankush Menat
a3c48da7f4 perf: enable client side caching for recorder flag 2025-01-06 18:57:57 +05:30
Ankush Menat
796e51df62 fix: limit # of keys by maxsize
Picking 1024 keys assuming 4kb avg size. In practice most things are
smaller so 1024 should be good enough!

This will likely only affect multitenant deploy with many sites.
2025-01-06 18:57:57 +05:30
Ankush Menat
590e7ff185 fix: Ensure that RESP3 is not in use
One can set it in conf and it won't work as expected because pubsub
format is different
2025-01-06 18:57:57 +05:30
Ankush Menat
67848aa920 fix: handle temporary disconnects 2025-01-06 18:57:57 +05:30
Ankush Menat
e21a7112e9 fix: flushall handler
Also no need to check channel names?
2025-01-06 18:57:57 +05:30
Ankush Menat
b96b8c815d feat: Initate client-side caching 2025-01-06 18:57:57 +05:30
Ankush Menat
55a55e7f7b
perf: Avoid checking server script map (#29057)
If I have to hazard a guess, 99% API calls are not server scripts, then
why check it first and pay the costs?

This PR first checks if method is a real method in python code and if
it's not found then only attempts to fetch it from server script map.

I'll revert this if I can bring the costs in acceptable limits with
client-side caching.
2025-01-06 07:40:20 +00:00
Ankush Menat
675ca02942
Merge pull request #29055 from ankush/rl_keys
fix: prevent rl keys from getting evicted
2025-01-06 12:05:43 +05:30
Ankush Menat
c03b5018d8
Merge pull request #29054 from ankush/perf/deletes
perf: Skip link checking on internal deletes
2025-01-06 11:59:00 +05:30
Ankush Menat
77fb1a0e3d fix: prevent rl keys from getting evicted 2025-01-06 11:56:03 +05:30
Ankush Menat
546260162d perf: Skip link checking on internal deletes
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.
2025-01-06 11:48:19 +05:30
Akhil Narang
e265832f78
Merge pull request #28913 from mahsem/form_control_translation
fix: form_builder_translation
2025-01-06 11:34:31 +05:30
Ankush Menat
7f0d4b3ee4
Merge pull request #29049 from ankush/perf/pydantic_less
perf: Don't validate types if there are no input types
2025-01-06 11:34:11 +05:30
Akhil Narang
443ba6004e
Merge pull request #28912 from mahsem/translation_chart_widget
fix: translation_chart_widget
2025-01-06 11:33:34 +05:30
Akhil Narang
e4ca94e88f
Merge pull request #28910 from mahsem/remove_plural
fix: remove_plural_from _modal
2025-01-06 11:33:19 +05:30
Ankush Menat
98cbe05c9a perf: use cached function signature 2025-01-06 11:23:30 +05:30
Ankush Menat
28aafcd708 perf: Don't validate types if there are no input types
Many functions just have return type annotated, in such cases running
validation code is not necessary.
2025-01-06 11:20:37 +05:30
Frappe PR Bot
df89d05975
fix: sync translations from crowdin (#28979) 2025-01-05 15:45:08 +01:00
Frappe PR Bot
6383de2ebb
chore: update POT file (#29047) 2025-01-05 15:44:42 +01:00
Ankush Menat
312263dee2
Merge pull request #29045 from ankush/test_distribution
ci: balance test distribution manually
2025-01-04 12:36:13 +05:30
Ankush Menat
6b0d13a5bf test: avoid rebuilding assets 2025-01-04 12:14:55 +05:30
Ankush Menat
e137e36180 test: don't sleep in webhook tests
Wasting 2 minutes doing nothing.
2025-01-04 12:07:04 +05:30
Ankush Menat
47af97661a test: avoid flaky behaviour on test ordering
If a test clears local.response and another test depends on it being
fresh inited then tests can fail.

E.g. response.docs might not exist.
2025-01-04 11:54:37 +05:30
Ankush Menat
13304cd36d ci: balance test distribution manually
Currently one test runner takes significantly longer than another. This
is entirely due to test_commands.py which needs to create new site and
do backup/restore tests etc. All of which are far far slower than other
tests.
2025-01-04 10:55:53 +05:30
Raffael Meyer
dce452e4b8
fix: improve grid style (#28966) 2025-01-03 20:09:40 +01:00
Raffael Meyer
bbb55108d2
fix: improve header alignment in table column selector (#28989) 2025-01-03 20:06:32 +01:00
Raffael Meyer
bba05d869f
perf: reduce klicks for changing link value (#28988) 2025-01-03 20:06:23 +01:00
Raffael Meyer
961f2c8fd1
fix(Country): remove unique constraint on Code field (#29039) 2025-01-03 18:28:50 +00:00