feat: add get_stats function to retrieve concurrency limits
This commit is contained in:
parent
0064eb80b4
commit
757f283eea
2 changed files with 12 additions and 1 deletions
|
|
@ -34,7 +34,6 @@ import orjson
|
|||
from werkzeug.datastructures import Headers
|
||||
|
||||
import frappe
|
||||
from frappe.concurrency_limiter import concurrent_limit
|
||||
from frappe.query_builder.utils import (
|
||||
get_query,
|
||||
get_query_builder,
|
||||
|
|
@ -1595,6 +1594,7 @@ from frappe.utils.error import log_error
|
|||
from frappe.utils.formatters import format_value
|
||||
from frappe.utils.print_utils import get_print, attach_print
|
||||
from frappe.email import sendmail
|
||||
from frappe.concurrency_limiter import concurrent_limit
|
||||
|
||||
# for backwards compatibility
|
||||
format = format_value
|
||||
|
|
|
|||
|
|
@ -112,3 +112,14 @@ def concurrent_limit(limit: int | None = None, wait_timeout: int = _DEFAULT_WAIT
|
|||
return wrapper
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_stats() -> dict:
|
||||
frappe.only_for("System Manager")
|
||||
cached_limit = _default_limit()
|
||||
gunicorn_limit = gunicorn_max_concurrency()
|
||||
return {
|
||||
"cached_limit": cached_limit,
|
||||
"gunicorn_limit": gunicorn_limit,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue