Add: Allow string ttl

If ttl is a string, parse to integer and check validity
This commit is contained in:
wooferguy 2023-07-11 22:46:20 +12:00
parent 3f23212514
commit 69fc06100b

View File

@ -64,7 +64,10 @@ module.exports = function(RED) {
node.warn("Expire time too high, using maximum setting of 10800s (3 hours) retry duration");
}
if (ttl !== null) {
if(!Number.isInteger(ttl) || ttl <= 0) {
if(typeof ttl === "string") {
ttl = parseInt(ttl);
}
if(isNaN(ttl) || !Number.isInteger(ttl) || ttl <= 0) {
ttl = null;
node.warn("No valid number for TTL found, not set");
}