Commit graph

92 commits

Author SHA1 Message Date
Aarol D'Souza
4ecb9bc57d
fix: clear cache and prevent data access after DocType deletion (#34307)
* fix: clear cache and prevent data access after DocType deletion

* fix: Handle potential DB failures during migrate

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2025-10-10 08:00:51 +00:00
Ankush Menat
4d7348d3c0 refactor: avoid code duplication 2025-06-11 09:55:36 +05:30
Ankush Menat
3167e03133 fix: invalidate persistent caches 2025-06-11 00:28:38 +05:30
sokumon
a1fca6ab63 fix: remove energy points / social module 2025-04-17 00:26:57 +05:30
Akhil Narang
ad32216040
fix: support sqlite
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:16 +05:30
Ankush Menat
fe3e5021a4 perf: use client_cache for form meta 2025-02-25 12:25:42 +05:30
Ankush Menat
dc5bbc15ce
fix: Wild card cache clearing for doctypes (#31415)
Clear all keys that contain doctype name. This is just a hack to avoid
dealing with many random partial caches that exist.

Possible improvement:
- Standardize ALL doctype specific cache keys so this becomes simple.
2025-02-25 05:19:41 +00:00
Ankush Menat
174783d0ab
perf: use client cache for doctype "maps" (#31105) 2025-02-05 06:46:47 +00:00
Ankush Menat
e3ce05b57e
perf: use client cache for notifications (#31094) 2025-02-04 09:24:30 +00:00
Ankush Menat
e4a2b8db38
refactor: trim init.py (#29866)
* refactor: Trim `__init__.py`

We strayed from the goal here: https://github.com/frappe/frappe/pull/29181

So making up for it.

* chore!: Delete unused get_version

Not used anywhere

* refactor: move few more functions to relevant place

* asd
2025-01-20 13:05:02 +00:00
Ankush Menat
fdba41c682
perf: misc client cache improvements (#29070)
* 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
2025-01-07 16:14:43 +05:30
Ankush Menat
06816f2817 perf: client-cache for defaults 2025-01-07 12:51:10 +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
e7139a1395 perf: store meta in client cache 2025-01-06 18:57:57 +05:30
Corentin Forler
e0c08fab4e
fix: Fix typo in build_domain_restriced function names 2024-11-20 13:52:19 +01:00
Akhil Narang
e6be7d6648
fix(setup_module_map): fix caching
Use a separate cache key depending on the arguments passed

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-28 17:41:18 +05:30
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
Akhil Narang
aa38d9e2f4
refactor: pipeline wherever possible, optimize calls
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-19 14:28:35 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Suraj Shetty
2bf82e80ba fix: Make sure sitemap respects robot_txt 2024-02-05 15:41:05 +05:30
Ankush Menat
8730de41f9
fix: Only clear doctype cache if specified (#21611) 2023-07-09 10:44:43 +05:30
Ankush Menat
8a37d6d278
perf: reduce memory usage of background processes (#21467)
* perf: defer translation.py imports

This indirectly imports babel which isn't really required most of the
time.

* perf: defer gzip import

* perf: move validate_and_sanitize_search_inputs

This causes all sorts of indirect imports and increases memory usage

* perf: defer requests module imports

* perf: defer system settings import

* perf: defer LOG_DOCTYPES import

Causes many indirect imports

* perf: defer update_site_config

* perf: defer notifications import

* perf: remove unused import

* perf: defer safe exec import

* test: memory usage overhead
2023-06-23 12:51:45 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Ankush Menat
84ef2cc89c fix: reliable cache clearing for doctype
reclear cache after commit to prevent stale caching.
2023-06-03 22:53:10 +05:30
Ankush Menat
98b4693dcf perf: finer cache eviction on db.set_value
Instead of nuking everything, just clear matching prefix
2023-06-03 22:53:10 +05:30
Raffael Meyer
12144505bc
fix: clear contacts cache (#20397) 2023-03-20 21:15:53 +05:30
Sagar Vora
30941c49f5 chore!: remove special local cache for documents 2023-01-21 17:28:42 +05:30
Sagar Vora
e208db7104
perf: only clear controller cache from current site (#19661)
* perf: only clear controller from current site

* chore: only pop current site controllers if doctype isnt specified
2023-01-20 14:36:42 +05:30
Sagar Vora
85f6f1e01d fix: dont clear doctype map keys when clearing doctype cache 2022-11-02 09:58:34 +00:00
Sagar Vora
380a638f3c chore: refactor duplicate code 2022-11-02 09:58:34 +00:00
Daizy
78d30905ac refactor: get_doctype_map() using single query and use generator for caching 2022-11-02 09:58:34 +00:00
Ankush Menat
20593f155d
fix: delete custom tables when doctype is deleted (#18433)
* fix: delete custom tables when doctype is deleted
2022-10-19 16:45:56 +05:30
Ankush Menat
2b6fc68088
Revert "fix: drop Meta cache during update" (#18186)
* Revert "fix: drop Meta cache during update (#18182)"

This reverts commit 656f6df257.

* fix: replace meta cache keys

Old keys stored different types of data `dict` changing key to indicate
change in type.
2022-09-19 21:28:45 +05:30
Sagar Vora
6c6a969d3a perf: simpler, faster meta cache 2022-09-19 16:21:11 +05:30
phot0n
41f96c7b01 chore: remove unused event_consumer_document_type_map from doctype_map_keys 2022-08-26 18:51:18 +05:30
Ankush Menat
2eec621e95 chore: db.get_all -> get_all
Reduces 1 pointless function call.
Function calls are also not "super cheap" in python.
2022-08-22 11:35:14 +05:30
Rushabh Mehta
fca6c3d305 fix(minor): circular imports? 2022-04-18 17:29:03 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Ankush Menat
e58c557e12 fix: correctly compute doctype name from table name 2022-01-24 11:18:21 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Gavin D'souza
30cf8fd58d refactor: Use run instead of frappe.db.sql 2021-08-12 18:36:43 +05:30
saxenabhishek
ee3c84beef style: typecast to string inside db.sql 2021-07-30 11:00:35 +05:30
saxenabhishek
49105ad08a refactor: qb in build_table_count_cache 2021-07-30 11:00:34 +05:30
Suraj Shetty
2d8c6c1710 Merge branch 'develop' of https://github.com/frappe/frappe into refactor-website 2021-06-03 11:43:28 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Suraj Shetty
e6d701b038 refactor: Use clear_website_cache instead of clear_cache 2021-05-25 15:02:18 +05:30
Suraj Shetty
86897c1808 refactor: Remove render.py and move all utility functions to utils.py
- Replace or remove all render imports
2021-05-25 10:53:35 +05:30
Faris Ansari
dd69f1ab43 fix: Hash based file naming
- For better HTTP caching and cache busting
- assets.json is created under [app]/dist folder which contains the map
of input file and output file name, this is used to get the correct path for
bundled assets
2021-04-29 13:30:07 +05:30
Faris Ansari
d927d393ee fix: Add autocompletion items in Server Script
- API to add autocompletion items in Code field
2021-04-17 23:09:16 +05:30
Suraj Shetty
4627d07bd0 fix: Post merge error 2021-01-19 10:42:30 +05:30