[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH] Add Retry-After header alongside the "use_load_threshold" feature to better manage bot load

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69654af6666ad_2c18126c3267a@gitlab-sidekiq-low-urgency-cpu-bound-v2-744f677bd7-mnmnc.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
1e1aac5b by Merci Jacob at 2026-01-12T19:18:16+00:00
[ENH] Add Retry-After header alongside the "use_load_threshold" feature to better manage bot load
---
* [ENH] Add Retry-After header alongside the "use_load_threshold" feature to better manage bot load

See merge request tikiwiki/tiki!9349

- - - - -


4 changed files:

- lib/prefs/load.php
- lib/setup/load_threshold.php
- templates/admin/include_general.tpl
- templates/admin/include_security.tpl


Changes:

=====================================
lib/prefs/load.php
=====================================
@@ -17,5 +17,15 @@ function prefs_load_list()
             ],
             'default' => 3,
         ],
+        'load_retry_after' => [
+            'name' => tra('Retry-After header value (in seconds) when site is closed due to high load'),
+            'type' => 'text',
+            'filter' => 'digits',
+            'size' => '3',
+            'dependencies' => [
+                'use_load_threshold',
+            ],
+            'default' => 120,
+        ],
     ];
 }


=====================================
lib/setup/load_threshold.php
=====================================
@@ -15,6 +15,7 @@ if (function_exists('sys_getloadavg')) {
 
     if ($prefs['use_load_threshold'] == 'y' && $tiki_p_access_closed_site != 'y' && ! isset($bypass_siteclose_check)) {
         if ($server_load > $prefs['load_threshold']) {
+            header('Retry-After: ' . $prefs['load_retry_after']);
             TikiLib::lib('access')->showSiteClosed('busy');
         }
     } else {


=====================================
templates/admin/include_general.tpl
=====================================
@@ -374,6 +374,7 @@
                 {preference name=use_load_threshold}
                 <div class="adminoptionboxchild" id="use_load_threshold_childcontainer">
                     {preference name=load_threshold}
+                    {preference name=load_retry_after}
                     {preference name=site_busy_title}
                     {preference name=site_busy_msg}
                 </div>


=====================================
templates/admin/include_security.tpl
=====================================
@@ -244,6 +244,7 @@
             {preference name=use_load_threshold}
             <div class="adminoptionboxchild" id="use_load_threshold_childcontainer">
                 {preference name=load_threshold}
+                {preference name=load_retry_after}
                 {preference name=site_busy_title}
                 {preference name=site_busy_msg}
                 <div class="col-sm-8 offset-sm-4">



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1e1aac5bee803ee4beb05cbabbd648da4326059d

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1e1aac5bee803ee4beb05cbabbd648da4326059d
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.