8000 perf: Apply backpressure on link counts by ankush · Pull Request #32712 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

perf: Apply backpressure on link counts #32712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions frappe/model/utils/link_count.py
< 814D td class="blob-num blob-num-expandable" colspan="2"> Expand All
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
}


LINK_COUNT_BUFFER_SIZE = 256


def notify_link_count(doctype, name):
"""updates link count for given document"""

@@ -50,13 +53,18 @@ def flush_local_link_count():

link_count = frappe.cache.get_value("_link_count") or {}

flush = False
for key, value in new_links.items():
if key in link_count:
link_count[key] += value
else:
elif len(link_count) < LINK_COUNT_BUFFER_SIZE:
link_count[key] = value
else:
continue
flush = True

frappe.cache.set_value("_link_count", link_count)
if flush:
frappe.cache.set_value("_link_count", link_count)
new_links.clear()


Expand Down
Loading
0