This is an automated email from the ASF dual-hosted git repository.

nickva pushed a commit to branch 3.5.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 6a270321d387ed66904047d3a118355c32872704
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Fri May 8 17:04:19 2026 -0400

    3.5.x backport of config:get_integer_or_infinity/2
    
    This was introduced in a feature commit not going into 3.5.x but then later
    fixes were depending on it. This is a backport to allow the release to work.
---
 src/config/src/config.erl | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/config/src/config.erl b/src/config/src/config.erl
index 70b8883f9..cfc613887 100644
--- a/src/config/src/config.erl
+++ b/src/config/src/config.erl
@@ -26,7 +26,7 @@
 -export([set/3, set/4, set/5]).
 -export([delete/2, delete/3, delete/4]).
 
--export([get_integer/3, set_integer/3, set_integer/4]).
+-export([get_integer/3, set_integer/3, set_integer/4, 
get_integer_or_infinity/3]).
 -export([get_float/3, set_float/3, set_float/4]).
 -export([get_boolean/3, set_boolean/3, set_boolean/4]).
 
@@ -87,6 +87,26 @@ get_integer(Section, Key, Default) when is_integer(Default) 
->
             Default
     end.
 
+get_integer_or_infinity(Section, Key, Default) when is_integer(Default); 
Default == infinity ->
+    case get_value(Section, Key, Default) of
+        infinity ->
+            infinity;
+        "infinity" ->
+            infinity;
+        _Value ->
+            IntDefault =
+                case Default of
+                    infinity -> 0;
+                    D when is_integer(D) -> D
+                end,
+            try
+                to_integer(get_value(Section, Key, IntDefault))
+            catch
+                error:badarg ->
+                    Default
+            end
+    end.
+
 set_integer(Section, Key, Value) ->
     set_integer(Section, Key, Value, true).
 

Reply via email to