Commit graph

3643 commits

Author SHA1 Message Date
Ankush Menat
967d3e828c fix: granular status in system health report
differentiate between dead process, manually disabled or dormant.
2025-02-25 10:38:25 +05:30
Ankush Menat
6db7cb096d fix: Better proxy for active site and disable on selfhosted 2025-02-25 10:37:29 +05:30
Ankush Menat
0d85bec58f fix: allow disabling dormancy behaviour
Set it to 0 to never trigger this again.
2025-02-25 10:37:29 +05:30
Corentin Forler
83f572d3d6 feat(scheduler)!: Make dormant sites opt-in 2025-02-25 10:37:29 +05:30
Nikhil Kothari
9c6f25afb0
fix: fetch data from submitted child rows for global search indexing (#31405) 2025-02-24 18:27:47 +05:30
Ankush Menat
17d6d81fb5
feat: mini pretty dates (#31331)
Narrow format pretty dates for list views, works the same way as client
side function.
2025-02-20 05:18:45 +00:00
Sagar Vora
4f374ee1c9 fix: ignore disable_traceback if _dev_server is True 2025-02-19 12:59:14 +05:30
Sagar Vora
f4062b4d7a fix: ensure consistent error in response 2025-02-19 12:10:59 +05:30
Ankush Menat
e2bd3abd62 fix: make nofork workers exit periodically 2025-02-17 18:55:25 +05:30
Ankush Menat
de7e6d0ba5 fix: force init background jobs 2025-02-17 18:47:59 +05:30
Ankush Menat
644bc5530e fix: Support stop-job, kill-horse etc 2025-02-17 18:40:11 +05:30
Ankush Menat
9dd005b21e refactor: separate worker type for nofork 2025-02-17 18:21:07 +05:30
Ankush Menat
0cebc61de1 fix: Exit worker on timeout exception
- Timeout in same process can leave bad state, so start a new worker.
- This isn't exactly costly, earlier we were forking all the time.
- Timeouts by definition can't happen too frequently.
2025-02-17 17:57:21 +05:30
Ankush Menat
3b4e1bbb48 perf: Support running RQ worker without forking
Frappe does everything required to run jobs without forking.
- We cleanup locals
- Global caches are invalidated appropriately
- We destroy connections and open a new one for job/request

So we don't have any safety benefit much from forking for every job.
There can still be some code out in wild that relies on this behaviour
though!

Pros:
- Almost zero-overhead background jobs, just like web requests.

Cons:
- Timeout need to be implemented separately now
- Unknown side effects!
- Some features like "stop job" will need separate implementations.
2025-02-17 16:20:52 +05:30
Ankush Menat
d0c3a8ee56
fix: check scheduler process status in health report (#31284)
Currently it's just checking if the scheduler is enabled or not. This PR
also adds a check to see if the process is running or not.
2025-02-17 05:04:07 +00:00
Corentin Forler
a4c4631c26
fix(rq): Replace ":" in job ID (#31194)
* fix(rq): Replace ":" in job ID

Required since python-rq >= 2.1

* fix: only check custom job IDs

---------

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2025-02-11 10:53:27 +00:00
Ankush Menat
ef3b0ef008
perf: Only filter last 3 months of data by default on large tables (#31216)
Applying something basic like `order id like xyz` filter can result in
full table scan on years of data. This isn't necessary most of the time.

Interactive queries are usually done on recent data, so add this filter
to ensure only recent data is checked first.

Users can remove this filter if they want to.
2025-02-11 09:24:08 +00:00
Maxim Sysoev
87b1e68081
feat: (UI) Show document title in Global Search result (#29131)
Showing title in n Global Search result, if title field set in doctype settings
2025-02-11 14:41:58 +05:30
Ankush Menat
aa71072d4a
build: bump RQ to 2.x (#31141)
* build: bump RQ to 2.x

* fix: dont use colon for job IDs
2025-02-05 12:18:03 +00:00
Akhil Narang
d7c3553714
chore: refactor for rq 2.x
There's no `Connection` anymore - we need to explicitly pass it in everywhere

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-01-29 17:38:23 +05:30
Akhil Narang
58268a6d8f
fix(sanitize_column): add newlines to the regex check
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-01-29 15:45:11 +05:30
barredterra
aeb8ac1cb9 feat: additional options for timespan filter 2025-01-28 12:37:38 +01:00
Ankush Menat
47fd3386fd
Revert "fix: Always reset globals on cached templates (#30897)" (#30906)
This reverts commit 32c1220c31.
2025-01-28 10:02:00 +00:00
Ankush Menat
32c1220c31
fix: Always reset globals on cached templates (#30897) 2025-01-28 05:59:57 +00:00
Raffael Meyer
829a1404da
chore: bump actions/cache to v4 in boilerplate (#30889) 2025-01-27 12:01:09 +00:00
Ankush Menat
078330485c
fix: Re-update jinja globals on cached templates (#30882) 2025-01-27 07:08:25 +00:00
Ankush Menat
6ea200a48f fix: handle typical client tracking errors 2025-01-25 10:15:50 +05:30
Ankush Menat
6328421fde fix: only cache if called directly 2025-01-24 19:08:04 +05:30
Ankush Menat
378b638d34 feat: Decorator to cache API response using cache-control headers 2025-01-24 18:35:26 +05:30
Abdeali Chharchhodawala
bebc40087c
chore: Update raise_error_on_no_output documentation and example 2025-01-22 08:12:08 +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
320798d390
perf: add cache-control headers on private files (#29221)
* perf: add cache-control headers on private files

- Client(browser) side cache
- 1 hr expiry
- 1 day revalidation
- etagged by nginx in default config (so no data transfer on expiry still)

In conjunction with https://github.com/frappe/agent/pull/157

* fix: Don't override existing headers
2025-01-17 18:51:34 +05:30
Ankush Menat
9ebfea1d08 perf: avoid duplicate template caching 2025-01-15 11:53:00 +05:30
Ankush Menat
829062b1e3 fix: make shared jenv thread-safe
A new copy is created for each request, but cache is shared.
2025-01-15 11:53:00 +05:30
Ankush Menat
2c2ec13874 perf: reuse jenv across requests 2025-01-15 11:53:00 +05:30
Akhil Narang
8b631dc0ed
Merge pull request #29156 from akhilnarang/partial-revert-26183
fix(csvutils): drop sniffer code
2025-01-15 11:20:18 +05:30
Akhil Narang
e5a3802dc5
feat(csvutils): make sniffer usage optional
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-01-15 10:58:41 +05:30
Ankush Menat
01f9787736 fix: catch template error for on-disk paths too 2025-01-14 20:04:36 +05:30
Ankush Menat
dc7636de8f perf: use cached user document 2025-01-14 19:01:31 +05:30
Ankush Menat
80f324cc04 perf: cache simple jinja templates 2025-01-14 18:26:56 +05:30
Ankush Menat
a89fd99794 perf: keep jloader across requests
This doesn't have anything that needs to be created for each request.
2025-01-14 18:18:19 +05:30
Akhil Narang
d9b9940a79
fix(csvutils): drop sniffer code
This seems to break certain CSVs, which the default excel dialect can handle fine

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-01-14 17:19:13 +05:30
Ankush Menat
c72e91f465
fix: backward compatible date parsing (#29155)
Even though we never use tz aware object in frappe this function
previously used to retain them, so keep TZinfo for sake of compat.

Nothing should be affected ideally.
2025-01-14 11:05:55 +00:00
Ankush Menat
b6a0e849a0 fix: Avoid mixing client cache and redis_wrapper 2025-01-14 15:20:47 +05:30
Ankush Menat
b49d512404 feat: cache documents in client cache
No need to query 1 key at a time.
2025-01-14 14:33:10 +05:30
Ankush Menat
cde1662791 perf: use client side cache for assets.json
Single shared key, worth the costs.
2025-01-14 13:57:41 +05:30
Ankush Menat
4d1ef02e25 feat: generator support for client cache
Similar to redis, for ergonomics
2025-01-14 13:55:28 +05:30
Ankush Menat
fab464effb feat: support shared keys in client cache 2025-01-14 13:52:29 +05:30
Ankush Menat
d46e2c20af
fix: Forward shared flag to cache generator (#29146)
Right now assets.json is read on every requests because of this bug.
2025-01-14 08:15:29 +00:00
Ankush Menat
2a5c778235
perf: speedup date parsing (#29090) 2025-01-09 06:55:13 +00:00