fix: procline crash (#31845)
* fix: Skip rollback if no DB * fix: drop proctitle from dependency - While it improves our own processes, it makes gunicorn process titles worse - It also crashes on mac because of some unknown reason related to fork-safety. Best to not use this.
This commit is contained in:
parent
92dd79dfe2
commit
5a5ad3032c
4 changed files with 2 additions and 13 deletions
|
|
@ -599,7 +599,8 @@ frappe.db.connect()
|
||||||
|
|
||||||
def _console_cleanup():
|
def _console_cleanup():
|
||||||
# Execute after_rollback on console close
|
# Execute after_rollback on console close
|
||||||
frappe.db.rollback()
|
if frappe.db:
|
||||||
|
frappe.db.rollback()
|
||||||
frappe.destroy()
|
frappe.destroy()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ from typing import Any, NoReturn
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
import redis
|
import redis
|
||||||
import setproctitle
|
|
||||||
from redis.exceptions import BusyLoadingError, ConnectionError
|
from redis.exceptions import BusyLoadingError, ConnectionError
|
||||||
from rq import Callback, Queue, Worker
|
from rq import Callback, Queue, Worker
|
||||||
from rq.defaults import DEFAULT_WORKER_TTL
|
from rq.defaults import DEFAULT_WORKER_TTL
|
||||||
|
|
@ -237,9 +236,6 @@ def execute_job(site, method, event, job_name, kwargs, user=None, is_async=True,
|
||||||
else:
|
else:
|
||||||
method_name = f"{method.__module__}.{method.__qualname__}"
|
method_name = f"{method.__module__}.{method.__qualname__}"
|
||||||
|
|
||||||
actual_func_name = kwargs.get("job_type") if "run_scheduled_job" in method_name else method_name
|
|
||||||
setproctitle.setproctitle(f"rq: Started running {actual_func_name} at {time.time()}")
|
|
||||||
|
|
||||||
frappe.local.job = frappe._dict(
|
frappe.local.job = frappe._dict(
|
||||||
site=site,
|
site=site,
|
||||||
method=method_name,
|
method=method_name,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import random
|
||||||
import time
|
import time
|
||||||
from typing import NoReturn
|
from typing import NoReturn
|
||||||
|
|
||||||
import setproctitle
|
|
||||||
from croniter import CroniterBadCronError
|
from croniter import CroniterBadCronError
|
||||||
from filelock import FileLock, Timeout
|
from filelock import FileLock, Timeout
|
||||||
|
|
||||||
|
|
@ -36,10 +35,6 @@ def cprint(*args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def _proctitle(message):
|
|
||||||
setproctitle.setthreadtitle(f"frappe-scheduler: {message}")
|
|
||||||
|
|
||||||
|
|
||||||
def start_scheduler() -> NoReturn:
|
def start_scheduler() -> NoReturn:
|
||||||
"""Run enqueue_events_for_all_sites based on scheduler tick.
|
"""Run enqueue_events_for_all_sites based on scheduler tick.
|
||||||
Specify scheduler_interval in seconds in common_site_config.json"""
|
Specify scheduler_interval in seconds in common_site_config.json"""
|
||||||
|
|
@ -57,7 +52,6 @@ def start_scheduler() -> NoReturn:
|
||||||
return
|
return
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
_proctitle("idle")
|
|
||||||
time.sleep(sleep_duration(tick))
|
time.sleep(sleep_duration(tick))
|
||||||
enqueue_events_for_all_sites()
|
enqueue_events_for_all_sites()
|
||||||
|
|
||||||
|
|
@ -118,7 +112,6 @@ def enqueue_events_for_site(site: str) -> None:
|
||||||
frappe.logger("scheduler").error(f"Exception in Enqueue Events for Site {site}", exc_info=True)
|
frappe.logger("scheduler").error(f"Exception in Enqueue Events for Site {site}", exc_info=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_proctitle(f"scheduling events for {site}")
|
|
||||||
frappe.init(site)
|
frappe.init(site)
|
||||||
frappe.connect()
|
frappe.connect()
|
||||||
if is_scheduler_inactive():
|
if is_scheduler_inactive():
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,6 @@ dependencies = [
|
||||||
"rauth~=0.7.3",
|
"rauth~=0.7.3",
|
||||||
"redis~=5.2.0",
|
"redis~=5.2.0",
|
||||||
"hiredis~=3.0.0",
|
"hiredis~=3.0.0",
|
||||||
"setproctitle~=1.3.3",
|
|
||||||
"requests-oauthlib~=1.3.1",
|
"requests-oauthlib~=1.3.1",
|
||||||
"requests~=2.32.0",
|
"requests~=2.32.0",
|
||||||
# We depend on internal attributes of RQ.
|
# We depend on internal attributes of RQ.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue