From f48e62df363337484edc84fd4648d3c1bf95fb37 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Windows 11)" <rob@synchro.net>
Date: Mon, 11 Nov 2024 01:20:03 -0800
Subject: [PATCH] Reduce LOOP_NOPEN and LOOP_USERDAT from 500 to 100

With the incremental backoffs, these were super long waits for locks. Not sure
about my math there, but at 500, the total timeout was not "about 45 seconds"
but rather several minutes.

At 100, the total max retry time should be almost exactly 45 seconds:

Retries      ms-per     total seconds
  0 - 9      0          0
 10 - 19     100        1
 20 - 29     200        3
 30 - 39     300        6
 40 - 49     400        10
 50 - 59     500        15
 60 - 69     600        21
 70 - 79     700        28
 80 - 89     800        36
 90 - 99     900        45*
100 - 109    1000       55
110 - 119    1100       66
120 - 129    1200       78
130 - 139    1300       91
140 - 149    1400       105
150 - 159    1500       120
160 - 169    1600       136
170 - 179    1700       153
180 - 189    1800       171
190 - 200    1900       200!

... so yeah, 500 was way too big a number.
---
 src/sbbs3/nopen.h   | 2 +-
 src/sbbs3/userdat.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sbbs3/nopen.h b/src/sbbs3/nopen.h
index 1084436cdb..9306406704 100644
--- a/src/sbbs3/nopen.h
+++ b/src/sbbs3/nopen.h
@@ -27,7 +27,7 @@
 #include "gen_defs.h"		/* bool */
 
 #define FNOPEN_BUF_SIZE		(2*1024)
-#define LOOP_NOPEN	  500	/* Retries before file access denied			*/
+#define LOOP_NOPEN	  100	/* Retries before file access denied			*/
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/src/sbbs3/userdat.c b/src/sbbs3/userdat.c
index 6169e7f200..4d864ee626 100644
--- a/src/sbbs3/userdat.c
+++ b/src/sbbs3/userdat.c
@@ -48,7 +48,7 @@
 #define USER_FIELD_SEPARATOR '\t'
 static const char user_field_separator[2] = { USER_FIELD_SEPARATOR, '\0' };
 
-#define LOOP_USERDAT 500
+#define LOOP_USERDAT 100
 
 char* userdat_filename(scfg_t* cfg, char* path, size_t size)
 {
-- 
GitLab