Skip to content

Commit e4c5ce9

Browse files
Raphael HaerleKamillendampf
authored andcommitted
Implement configurable timeout
add function get_timeout_config() with fallback of 30 sekonds, if no timeout is set. add text field with int in pdf_on_submit settings
1 parent 3565746 commit e4c5ce9

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

pdf_on_submit/attach_pdf.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def process_enabled_doctype(doc, settings, in_background):
5454

5555
frappe.enqueue(
5656
method=execute,
57-
timeout=30,
57+
timeout= get_timeout_config(),
5858
now=bool(
5959
not in_background
6060
or frappe.flags.in_test
@@ -64,6 +64,13 @@ def process_enabled_doctype(doc, settings, in_background):
6464
**args,
6565
)
6666

67+
def get_timeout_config() -> int:
68+
timeout = frappe.get_single_value("PDF on Submit Settings", "timeout")
69+
print(f"Timeout: {timeout}")
70+
if timeout:
71+
print(f"Timeout: {timeout}")
72+
return timeout
73+
return 30 #fallback if no timeout is set
6774

6875
def execute(
6976
doctype,

pdf_on_submit/pdf_on_submit/doctype/pdf_on_submit_settings/pdf_on_submit_settings.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"field_order": [
88
"section_break_1",
99
"enabled_for",
10+
"timeout",
1011
"section_break_8",
1112
"create_pdf_in_background"
1213
],
@@ -31,12 +32,17 @@
3132
"fieldtype": "Table",
3233
"label": "Enabled For",
3334
"options": "Enabled DocType"
35+
},
36+
{
37+
"fieldname": "timeout",
38+
"fieldtype": "Int",
39+
"label": "Timeout"
3440
}
3541
],
3642
"icon": "octicon octicon-file-pdf",
3743
"issingle": 1,
3844
"links": [],
39-
"modified": "2021-01-13 15:44:40.308041",
45+
"modified": "2025-08-21 17:00:18.594858",
4046
"modified_by": "Administrator",
4147
"module": "PDF on Submit",
4248
"name": "PDF on Submit Settings",
@@ -62,7 +68,9 @@
6268
}
6369
],
6470
"quick_entry": 1,
71+
"row_format": "Dynamic",
6572
"sort_field": "modified",
6673
"sort_order": "ASC",
74+
"states": [],
6775
"track_changes": 1
68-
}
76+
}

0 commit comments

Comments
 (0)