Commit graph

1729 commits

Author SHA1 Message Date
Ankush Menat
360d19741e fix(recorder): patch replica DB connection 2025-04-24 11:02:03 +05:30
Akhil Narang
294013955e
chore: linting
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:17 +05:30
Akhil Narang
ad32216040
fix: support sqlite
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:16 +05:30
Akhil Narang
0b5e245507
feat: init sqlite
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:16 +05:30
jll-02
89ed7c90a7
feat: addes x-priority option to email header and the frappe.sendmail function (#31966)
creating the option to give the email an importance.
1 = Highest, 3 = Normal, 5 = Lowest
commonly used to flag the importance of emails

Co-authored-by: Jan Lukas Liesen <=>
2025-04-11 16:18:19 +05:30
rohitwaghchaure
d69a364e10
fix: item code not showing in the error message (#32028) 2025-04-08 14:20:35 +00:00
Sagar Vora
bd844579d2 refactor: trim frappe.__init__ 2025-04-06 10:30:23 +05:30
Sagar Vora
d82a1a443c perf: reduce attribute access in setup_module_map 2025-03-20 08:28:33 +05:30
Sagar Vora
f51f175ad2 chore: remove invalid type hint 2025-03-20 08:27:29 +05:30
Sagar Vora
41a8b708d1 perf(DX): store hooks in site cache 2025-03-20 07:43:08 +05:30
Sagar Vora
15d753ea52
Merge pull request #31811 from sagarvora/cache-params-directly
perf: cache signature params instead of signature
2025-03-20 01:06:25 +05:30
Sagar Vora
6435a77e41 perf: cache signature params instead of signature 2025-03-20 00:55:52 +05:30
Raffael Meyer
9430e3af86
fix: respect override_whitelisted_method in map_docs (#31718)
* refactor: override_whitelisted_method

* fix: respect `override_whitelisted_method` in `map_docs`

* refactor: override_whitelisted_method
2025-03-17 14:27:12 +01:00
Sagar Vora
b2cab51849
feat: re-introduce mysqlclient 🚀 (#31719)
* feat: mysqlclient

* fix: update error attrs

* fix: decode mogrified query to unicode

* fix: do some cleanup

* chore: disable cleanup for now

* fix: remove unnecessary call to as_unicode

* test: skip perf test for now

* fix: fallback to empty str

* fix: unbuffered cursor support

* fix: update converters and other changes

* fix: add cleanup back

* perf: improve timedelta converter

* fix: dont attempt to run query when explain flag is set

* test: cleanup tests

* chore: remove commented code

* perf: store conf as local var

* chore: ensure sequence

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2025-03-15 09:48:21 +05:30
Sagar Vora
042372ea86 perf: remove __getattr__ from local & localproxy 2025-03-13 22:36:31 +05:30
Sagar Vora
ad33435b33
Merge pull request #31660 from sagarvora/frappelocal
perf: faster local attr lookup
2025-03-12 14:13:46 +05:30
Sagar Vora
26bbb5985e
perf: use client_cache for print_sql (#31663)
* perf: use `client_cache` for `print_sql`

* chore: revert change to conn error handling code

---------

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2025-03-12 08:43:09 +00:00
Sagar Vora
3c8912f6e7 perf: faster local attr lookup 2025-03-12 14:03:36 +05:30
Sagar Vora
20220ef894
fix: avoid one time setup (#31650) 2025-03-12 12:44:19 +05:30
Ankush Menat
6946e3353f refactor: split messages.py from init.py 2025-03-10 21:02:13 +05:30
Ankush Menat
ae4e2ede1a refactor: move init.py utils to utils/* 2025-03-10 21:01:14 +05:30
Maharshi Patel
15b025f03b chore: move get_print to print_utils.py
paying my share of taxes #28940
2025-03-08 11:40:31 +05:30
Maharshi Patel
c8b40b1805 Merge branch 'develop' into add_pdf_backend_hook 2025-02-28 10:15:32 +05:30
Sagar Vora
6e20eed640 fix: redo some fixes to ensure cypress passes 2025-02-20 12:51:37 +05:30
Maharshi Patel
11bac014f2 Merge branch 'develop' into add_pdf_backend_hook 2025-02-19 14:21:01 +05:30
Sagar Vora
f4062b4d7a fix: ensure consistent error in response 2025-02-19 12:10:59 +05:30
Maharshi Patel
463d1f2b05 fix: code changes as pdf_generator is now select field 2025-02-14 17:04:13 +05:30
Maharshi Patel
fc213ed761 fix: check for chrome_pdf_generator in form_dict first.
first check if chrome_pdf_generator is available in form_dict.
if not available which can happen if function is called from other places then set value from args or print_format.
2025-02-14 11:04:24 +05:30
Maharshi Patel
61aabd00af chore: renamed arg name and cleanup
- fixed chrome_pdf_backend arg by making it int and using it to properly override which pdf generator (chrome / wkhtmltopdf) to use.
- renamed new_pdf_backend to chrome_pdf_backend.
- added chrome_pdf_backend arg in local.from_dict to avoid passing it 4-5 functions deep
2025-02-12 13:24:50 +05:30
Maharshi Patel
cf0fe8eecd fix: read_file return base64 encoded string
- added flag to read_file to return base64 encoded string
- fixed pdf_header_footer_chrome to remove unused subst function call
- added new_pdf_backend flag to get_print_format_template function
2025-02-04 20:36:44 +05:30
Maharshi Patel
3caa2414e0 chore: Merge branch 'develop' into add_pdf_backend_hook 2025-02-01 19:58:11 +05:30
Maharshi Patel
dd037f54ea feat(minor): add pdf backend hook
added new_pdf_backend hook to run alternate get_pdf function from other apps e.g. print designer.
2025-02-01 19:47:29 +05:30
Ankush Menat
f30159adc6 feat: custom response header support 2025-01-24 18:35:26 +05:30
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
Sagar Vora
e7073a5f28
perf: faster LocalProxy (#29181)
* perf: faster `LocalProxy`

* refactor: use callable style local

* test: add some tests for local proxy override

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2025-01-20 12:49:55 +00:00
Ankush Menat
cc838022b1 perf: use client cache for fetching website settings and theme 2025-01-14 14:40:25 +05:30
Ankush Menat
374bba5979 perf: use client cache for metadata version 2025-01-14 13:28:42 +05:30
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
73dc99275d refactor: move get_system_settings
- This should not be in init.py
- set_single_value is not a good alternate for properly cleaning up cache.
2025-01-06 20:31:38 +05:30
Ankush Menat
b7ddd1df92 perf: cache hooks in client-side cache 2025-01-06 20:24:27 +05:30
Ankush Menat
b60a1292bd perf: store app-module mappings in client cache 2025-01-06 19:46:42 +05:30
Ankush Menat
7ea0421624 perf: cache system settings in client side cache 2025-01-06 19:40:07 +05:30
Ankush Menat
15f5adc25a refactor: use namedtuple for readability 2025-01-06 19:28:33 +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
e7139a1395 perf: store meta in client cache 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
46dbb2f0cd
perf: Evict site cache only on frappe.clear_cache() (#29033)
For doctype/user specific cache eviction, no need to remove site_cache.

Rationale:
- Site cache is worker specific, so this eviction doesn't help much.
- Anything that might need to be evicted from site cache should be
  manually cleared or use a TTL.

Maybe we can just replace all of site_cache usage with
https://github.com/frappe/frappe/pull/28992 once it's stable.
2025-01-03 11:38:53 +05:30
Ankush Menat
c75febb5d4
fix: register fault hander after gunicorn registers signals (#28976)
Ugh, currently gunicorn is overriding our signal handler and we don't
care about gunicorn's SIGUSR1 handler.
2024-12-31 14:01:19 +00:00
Ankush Menat
766cb64d55
perf!: Cache site configs in memory for 60 seconds (#28869)
This is middle ground between caching it completely and requiring a
restart/signal to reload vs always reloading it.

I don't know any use cases that can break from this, nowhere in code
configs should be expected to reload instantly.

This change is only applied to requests for now
2024-12-27 16:21:14 +00:00
Ankush Menat
c4b8560247
fix: Ensure only one Redis connection is created (#28930)
There is no gaurantee that setup_cache is only called once. This PR adds
a mutex lock to ensure only one thread gets to create the connection. If
both arrive at same time then one of them will be blocked until
connection is setup.

So far this hasn't been an issue because the "orphan" connection would
just get garbage collected but if you setup any kind of listener on it
or refer to it then it will keep running forever hurting performance.

This just has small performance impact on first request that sets up the
connection, in absence of contention the lock should have almost no
overhead. I make up for it by eliminating one function call :pinch:
2024-12-27 12:55:32 +05:30