Commit graph

42175 commits

Author SHA1 Message Date
Ankush Menat
0d056a3a2b test: fix broken tests
Fixture test:
This is broken cause it's trying to find doctype after it has been
deleted (wut?)
It was working so far because cache wasn't cleared correctly so you'd
still find it from cache.

db.set_value test:
converted to use last query instead of patching SQL
2023-06-03 22:53:10 +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
7d50ef19d3 perf: Delete multiple keys in O(1) redis calls
Currently we call redis for each key, redis already supports deleting
multiple keys in one go.
2023-06-03 22:53:10 +05:30
Ankush Menat
4193a251a5 fix: Invalidate cache on rollback too
Steps:
    - Document modified
    - Document refetched from cache
    - Transaction rolled back
    - Cache now contains unmodified changes.
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
Ankush Menat
356a2587e2 refactor: Use plain keys instead of hashes for caching
- Hashes are supposed to be used for representing complex object, not
  multiple documents of same DocType.
- Redis's auto cache clearing wont clear individual key from hashes even if they
  are rarely used.
- Keys can have expiry.
2023-06-03 22:53:10 +05:30
Ankush Menat
106ff1f1ee fix: move cache clearing away from document
Passing lambda function from inside document object would keep reference
to document alive. This means increasing memeory usage in bulk
processing.

Refer https://github.com/frappe/frappe/pull/17061 for example

This also extends it to db.set_value
2023-06-03 22:53:10 +05:30
Ankush Menat
be1da0dd00 chore: remove duplicate cache clearing 2023-06-03 22:53:10 +05:30
Ankush Menat
339cbf208c fix: Cache clearing implementation 2023-06-03 22:53:10 +05:30
Ankush Menat
6717b07ab9 perf(customize_form): rebuild global search in bg 2023-06-03 22:28:35 +05:30
Ankush Menat
07e1d34568 refactor: RQ enqueue after commit and tests 2023-06-03 18:44:19 +05:30
Ankush Menat
0b9dee4791 test: db callbacks 2023-06-03 18:44:19 +05:30
Ankush Menat
54ae0c4a21 refactor: move flush_realtime_log to realtime.py
This doesn't have anything to do with databases
2023-06-03 18:44:19 +05:30
Ankush Menat
6ce7444669 refactor: generic callback manager 2023-06-03 18:44:19 +05:30
Ankush Menat
680cf73cba fix: link_count
This didn't work correctly, if link_count is present in cache it would
just read and dump it back in.

This has practically never worked correctly.
2023-06-03 18:44:19 +05:30
Ankush Menat
3f1c66de10 refactor: move flush_local_link_count to hook 2023-06-03 18:44:19 +05:30
Ankush Menat
ccc107b41f test: use db.before_commit 2023-06-03 18:44:19 +05:30
Ankush Menat
6519651002 refactor: change implementation of enqueue_after_commit
if enqueue_after_commit then pass partial function after commit instead
of storing it in flags. SLIGHTLY less efficient, but uses consistent API.
2023-06-03 18:44:19 +05:30
Ankush Menat
b3d370a0b1 refactor!: remove rollback_observers
use `frappe.db.after_rollback.add` instead
2023-06-03 18:44:19 +05:30
Ankush Menat
7e9ef00bea refactor!: Remove frappe.db.add_before_commit
Not used anywhere, use `frappe.db.before_commit.add()` instead.
2023-06-03 18:44:19 +05:30
Ankush Menat
235e4855c2 feat: DBHooks to run things before/after commit/rollback
This is a common pattern which is implemented in inconsistent and undocumented ways using these:

- `frappe.local.rollback_observers`
- `frappe.flags.enqueue_after_commit`
- `frappe.local.realtime_log`
- `frappe.local.before_commit`
- `flush_local_link_count`

Instead new simple api:

- Simple function call `frappe.db.after_commit.run(function)`
- If you need args just pass partial function `frappe.db.after_commit.run(lambda: frappe.clear_cache(doctype, name)`
2023-06-03 18:44:19 +05:30
Shariq Ansari
a049b7f9cf
Merge pull request #21220 from shariquerik/multiple-webform-for-same-doctype 2023-06-03 17:50:37 +05:30
Shariq Ansari
38513ccac5
Merge branch 'develop' into multiple-webform-for-same-doctype 2023-06-03 17:27:01 +05:30
Shariq Ansari
042595ca92 fix: handle multiple webform for same doctype 2023-06-03 16:52:51 +05:30
Ankush Menat
5185374f72
refactor!: Remove dynamic addition of _comments (#21217)
This isn't required anymore, was added to handle old sites.
2023-06-02 21:57:58 +05:30
Ankush Menat
cb885a86ae feat: allow clearing view logs
These dont need to exist for eternity. Let site admins decide when to
drop them.
2023-06-02 17:32:33 +05:30
Ankush Menat
f12773487a
Merge pull request #21206 from resilient-tech/attach-formatter
feat: formatter for `Attach` and `Attach Image` fields
2023-06-02 16:57:01 +05:30
Ankush Menat
691cbd6da7 chore: remove select from ddl prefix 2023-06-02 16:39:58 +05:30
Shariq Ansari
1d0078038d
Merge pull request #21209 from shariquerik/workspace-minor-fix 2023-06-02 16:19:59 +05:30
Shariq Ansari
ac95b7496b fix: do not render custom cards if workspace does not contain content 2023-06-02 16:16:39 +05:30
Sagar Vora
cad6f938c1 feat: formatter for Attach and Attach Image fields 2023-06-02 14:28:48 +05:30
Sagar Vora
f65198fba3 chore: ignore formatting commit
[skip ci]
2023-06-02 14:28:04 +05:30
Sagar Vora
f223bc0249 chore: fix formatting in user.py 2023-06-02 14:26:50 +05:30
Suraj Shetty
e2403cc12b
Merge pull request #21204 from JeansReal/develop 2023-06-02 13:02:38 +05:30
Suraj Shetty
e1c23ef4f3
Merge pull request #21064 from frappe/feat-dynamic-webhook-url 2023-06-02 13:02:12 +05:30
Suraj Shetty
66d08ba365
Merge branch 'develop' into develop 2023-06-02 12:45:59 +05:30
Suraj Shetty
69927ce12f
Merge pull request #21110 from yjane99/customise-welcome-password-reset-emails 2023-06-02 12:41:49 +05:30
Ankush Menat
a09e29cfa0
Merge pull request #21173 from resilient-tech/safe-filters
fix!: improved filter validation in `Engine.get_query`
2023-06-02 11:45:06 +05:30
Maharshi Patel
6fd9c44391
fix: ui tour popover when outside viewport (#21164)
* fix: ui tour always popover inside viewport

There are times when popover will go outside viewport this updates the style on highlight to make sure it doesn't.

* fix: don't run form ui tours on small screens.

* Revert "fix: don't run form ui tours on small screens."

This reverts commit b11aaf8d182fa07369f17b914e8a0cb3e7327a18.


[skip ci]
2023-06-02 10:53:05 +05:30
Jeans K. Real
f8edb3dc3d Closing span tags on form_links.html and list_view status field indicator. Also Removed extra calls from multicheck.js 2023-06-01 19:10:29 -06:00
Dhia' Alhaq Shalabi
efff6ebba7
fix: doctype name localization (#21197)
[skip ci]
2023-06-01 12:09:25 +05:30
Ankush Menat
83e3a20901 feat: allow clearing web page views 2023-05-31 17:50:10 +05:30
Ankush Menat
3bbe4498a0 feat: allow re-running patches in developer mode
Simpler debugging.
2023-05-31 16:39:29 +05:30
Ankush Menat
4104e7d733
feat: show db table utilization on doctype (#21193)
* feat: show db table utilization on doctype

* fix: nicer error message with docs
2023-05-31 16:28:44 +05:30
Ankush Menat
950277a88d chore: increase logging level 2023-05-31 16:04:56 +05:30
Ankush Menat
48539dc0a3
feat: log all DDL queries (#21107) 2023-05-31 16:00:59 +05:30
Suraj Shetty
8750d39141
Merge pull request #21183 from surajshetty3416/print-letterhead-warning 2023-05-31 15:46:38 +05:30
Suraj Shetty
eda8be74ca fix: Hide font-size from print format
- Since it is only used in new print format builder
and it can be set via new print format builder's interface
2023-05-31 15:44:05 +05:30
Suraj Shetty
1fd84f6b09 fix: Remove field_id from URL
- scroll to field is not yet supported
2023-05-31 15:42:50 +05:30
Sagar Vora
1b2d1dd567 chore: move statement to set validate_filters property 2023-05-31 14:20:26 +05:30