Commit graph

37987 commits

Author SHA1 Message Date
Ankush Menat
51b11208e4 test: add perf test to prevent adding more redis calls 2025-01-01 14:42:13 +05:30
Ankush Menat
cbb39d463a perf: Don't query redirects on existing session
This is only used for a new user. After that it's never used but still
present in EVERY request!

https://ankush.dev/p/flamegraph-missing-forest-for-trees

towards https://github.com/frappe/caffeine/issues/15
2025-01-01 14:29:36 +05:30
sokumon
171eab1387
Merge pull request #28967 from sokumon/better-sidebar
fix: improved sidebar
2025-01-01 12:23:31 +05:30
Akhil Narang
3a0fdd3993
Merge pull request #28888 from sokumon/center-me-page
fix: Center /me, some other pages and fix /logout
2025-01-01 10:55:12 +05:30
Akhil Narang
7c8c1e73a4
chore: format
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-01-01 10:41:41 +05:30
sokumon
b0ecec2e18 fix: center me page and fix logout 2025-01-01 03:26:56 +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
sokumon
46f430c59a fix: centered app label , logo size fix in apps switcher menu 2024-12-31 18:31:46 +05:30
sokumon
41f220d092 fix: update sidebar for private workspace 2024-12-31 17:44:56 +05:30
sokumon
24505f1cfa fix: cleanup sidebar UI, app switcher 2024-12-31 17:25:17 +05:30
Ankush Menat
bd3af4391f
fix: Commit ID parsing (#28975)
This is/was never returning anything.

- Arguments come before revs
- `cd` is kinda unnecessary
2024-12-31 10:33:57 +00:00
Frappe PR Bot
4e761e61d4
fix: sync translations from crowdin (#28954) 2024-12-31 01:58:10 +01:00
Raffael Meyer
fe196062b5
fix(Web Form): add syntax highlighting for client script (#28964) 2024-12-30 22:16:37 +00:00
Raffael Meyer
cbda036daf
fix(Web Form): position of country code in "Phone" control (#28962) 2024-12-30 21:25:54 +00:00
Raffael Meyer
e5387a1272
feat(Country)!: formalise the code field (#28307) 2024-12-30 12:34:30 +00:00
Sumit Bhanushali
c654559a4a
Merge pull request #28958 from frappe/addr_fix
fix: update address link title on update of customer
2024-12-30 15:02:52 +05:30
Ankush Menat
3788f30b5b
perf: reduce RQ Worker's polling frequency (#28957) 2024-12-30 14:37:00 +05:30
Sumit Bhanushali
0d278dbadf fix: update address link title on update of customer 2024-12-30 14:20:48 +05:30
Ankush Menat
bada7cab13
perf: No need to set expiry for rate limiter key everytime (#28956)
* perf: No need to set expiry for key everytime

* fix: Set expiry on first request and never again

This prevents problem of rate limiter keys growing constantly.
2024-12-30 07:31:47 +00:00
Francisco Roldán
6cd2ab8789
fix: sidebar translatable (#28839) 2024-12-29 19:57:20 +01:00
mahsem
8f2c565249
fix: rename_modal_translation (#28937) 2024-12-29 19:35:49 +01:00
Frappe PR Bot
2404b967e5
fix: sync translations from crowdin (#28779) 2024-12-29 18:36:04 +01:00
frappe-pr-bot
0f4a9ea678 chore: update POT file 2024-12-29 09:33:23 +00:00
Ankush Menat
0f546c33b3
test: impose tax on __init__.py (#28940)
Call it a new year's resolution.

`frappe/__init__.py` has grown crazy big over time and left unattended it will continue to grow.

This new ~test~ tax will require reducing 3 line per day (so ~1000 in a year) from 1st Jan 2025 onwards. I am offering a headstart of 50 days in this PR by moving ~150 lines: #28869
2024-12-28 10:16:33 +05:30
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
28453f59f8
refactor: Flatten @site_cache's internal representation (#28939)
This makes maxsize deterministic while estimating memory costs of
using this function.

E.g. If I want to cache site config and I'd prefer to keep 16 recent
site configs in memory, there's no way to handle this. Site specific
maxsize means if I have 1000 sites on bench I'll have 1000 keys in
cache.

This change makes behaviour similar to lru_cache which is how I thought
it workerd TBH.
2024-12-27 15:50:07 +00:00
Ankush Menat
416919e880
Revert "feat: Use RESP3 for Redis cache connections (#28929)" (#28938)
This reverts commit 6f7b4c412e.
2024-12-27 13:19:35 +00:00
Ankush Menat
787ae8a438
fix: Skip rate limit counters when cleaning cache (#28932) 2024-12-27 07:48:10 +00:00
Ankush Menat
841c0207e7
perf: lower reminders frequency (#28931)
change from 4 -> 15 minutes

Closes https://github.com/frappe/frappe/issues/28927

I agree with issue, this is too frequent for a feature that isn't used
by that many.
2024-12-27 07:37:25 +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
Ankush Menat
6f7b4c412e
feat: Use RESP3 for Redis cache connections (#28929)
RESP3 has PUSH support which is useful for implementing client side
caching. Enabling this before I work on that to test if anything breaks
with this.

No need to do this for background jobs instance just yet, infrequent
accesses and performance doesn't matter as much.
2024-12-27 06:15:59 +00:00
Ankush Menat
11a6dfb6a0
revert: bencher/bench intrface (#28925) 2024-12-26 14:41:36 +00:00
Ankush Menat
60a3c41c7a
perf: Avoid storing redundant information - last session update (#28922)
Session contains the same exact information, so why do we need this?
2024-12-26 12:38:14 +00:00
Ankush Menat
3ab2c2fbcf
perf: speedup rate limiter by ~1.2x (#28920)
* perf: reuse current time

now_datetime is site-tz-aware, we don't need it here.

* perf: dont need redis transactions

* perf: use `time.time()` instead of datetime

Using `datetime.timestamp()` is a round-about way to use `time.time()`
with extra cost of dealing with datetime and timezones.

* perf: define slots for rate_limiter

* fix!: Remove used rate limit header

This just shares how much was consumed in current request, people can
just time requests to get an approximation for this, not sure why is this
useful.
2024-12-26 10:57:46 +00:00
Ankush Menat
304dae9136
Merge pull request #28916 from ankush/perf/skip_defaults
perf: use system settings instead of defaults
2024-12-26 12:06:37 +05:30
Ankush Menat
41d4155bba perf: Use system settings directly for fetching language 2024-12-26 11:52:44 +05:30
Ankush Menat
03036bfc91 perf: Use system settings for fetching expiry
It's just copy of the same data. IMO sys settings is always the "true"
source of truth.
2024-12-26 11:27:27 +05:30
frappe-pr-bot
12c2463e2a chore: update POT file 2024-12-25 19:11:54 +00:00
Akhil Narang
2af6eedec9
Merge pull request #28873 from krantheman/fix-html-editor
fix(HTML Editor): extraction of images
2024-12-24 16:14:00 +05:30
Akhil Narang
731384ea7f
Merge pull request #28899 from akhilnarang/clean-communication-html
fix(_get_communications): clean email content before returning
2024-12-24 16:12:38 +05:30
Akhil Narang
0d124ccd37
fix(_get_communications): clean email content before returning
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-24 15:11:36 +05:30
Ankush Menat
8db2e1e2a6
fix: Avoid applying pinning optimization on RQ (#28896)
We only need it for gunicorn workers.
2024-12-24 09:41:18 +00:00
Akhil Narang
7af83f6d37
Merge remote-tracking branch 'upstream/develop' into invalid-encr-key-message
* upstream/develop: (1373 commits)
  perf: cache dynamic links map in Redis (#28878)
  fix: Never query `flag_print_sql` in `developer_mode=0` (#28884)
  fix(restore): remove MariaDB view security definers
  fix: sanitize user input during setup wizard
  feat(sanitize_column): improve check
  refactor: make optimizations.py private entirely (#28872)
  fix(site_cache): site cache thread safety (#28870)
  chore(printview): change error message
  perf: speedup `frappe.call` by ~8x (#28866)
  test: reduce noise in test output (#28862)
  chore: spelling_invalid_values (#28858)
  fix: Remove misleading os.O_NONBLOCK flag (#28859)
  fix: string replacement in error logger
  perf(gthread): Pin web workers to a single core (#28854)
  fix: MariaDBDatabase.get_tables() should not query the entire database schema (#28846)
  fix: add strings and fields to translation
  fix: typo in test controller boilerplate
  perf: faster add_to_date (#28843)
  perf(version): Make get_versions fast for autoincrement doctypes (#28847)
  refactor: log in monitor as well
  ...
2024-12-24 12:36:33 +05:30
Akhil Narang
6b9960ca5c
chore: update message
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-24 12:35:19 +05:30
Akhil Narang
da5cfd9ad7
Merge pull request #28772 from mahsem/add_Swedish_date_and_time_format
fix: add Swedish date and time format
2024-12-24 12:33:55 +05:30
Akhil Narang
105a3b153d
Merge pull request #28513 from akhilnarang/fix-retry-background-job-after-job-hook
fix(background_jobs): init site if required for after_job hooks
2024-12-24 11:38:32 +05:30
Akhil Narang
c80cb525ea
Merge pull request #28876 from akhilnarang/improve-query-sanitization
feat(sanitize_column): improve check
2024-12-24 11:07:43 +05:30
Akhil Narang
6b8983cb91
Merge pull request #28877 from Sanket322/sanitize_input
fix: sanitize user input during setup wizard
2024-12-24 11:07:05 +05:30
Ankush Menat
3cb8a9e2e4
perf: cache dynamic links map in Redis (#28878)
Note about correctness: Once site has seen enough usage this map will rarely change. So the
problem of "cache inconsistency" is very rare, still care is taken to
avoid possible cache inconsistencies.
2024-12-23 19:43:05 +05:30
Ankush Menat
4f628ca091
fix: Never query flag_print_sql in developer_mode=0 (#28884)
Unnecessary overhead and need to disable this everytime I want to get
realistic performance numbers out.

All the performance affecting toggles should be directly controlled by
just `developer_mode` alone.
2024-12-23 13:57:01 +00:00