From e85aa448437818c91ef684278232b48c5a3fba6a Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 23 Dec 2024 10:52:13 +0530 Subject: [PATCH] fix: Remove misleading os.O_NONBLOCK flag (#28859) This works likes this in C `open(2)` on file descriptor, not in python :) In python it's setting buffering to enum value which in this case is 2048, if it were lower number this would've made performance worse. ref: - https://man7.org/linux/man-pages/man2/open.2.html#DESCRIPTION - https://docs.python.org/3/library/functions.html#open --- frappe/monitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/monitor.py b/frappe/monitor.py index 55512a8abd..a02704f9e0 100644 --- a/frappe/monitor.py +++ b/frappe/monitor.py @@ -127,7 +127,7 @@ def flush(): logs = frappe.cache.lrange(MONITOR_REDIS_KEY, 0, -1) if logs: logs = list(map(frappe.safe_decode, logs)) - with open(log_file(), "a", os.O_NONBLOCK) as f: + with open(log_file(), "a") as f: f.write("\n".join(logs)) f.write("\n") # Remove fetched entries from cache