From 273d565e9e020f7af3d8a381fcb1b48d5d16a67f Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 25 Aug 2020 09:30:00 -0400 Subject: [PATCH] fix: fix mailserver getting a random with a possible wrong index --- src/status/mailservers.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/status/mailservers.nim b/src/status/mailservers.nim index 718167f66a..1356e19566 100644 --- a/src/status/mailservers.nim +++ b/src/status/mailservers.nim @@ -152,7 +152,7 @@ proc autoConnect*(self: MailserverModel) = # Picks a random mailserver amongs the ones with the lowest latency # The pool size is 1/4 of the mailservers were pinged successfully randomize() - let mailServer = availableMailservers[rand(poolSize(availableMailservers.len))][0] + let mailServer = availableMailservers[rand(poolSize(availableMailservers.len - 1))][0] self.connect(mailserver) proc changeMailserver*(self: MailserverModel) =