From 04d2b0246a52a70544ad86a0e4dac3c82830f9be Mon Sep 17 00:00:00 2001 From: ycc Date: Tue, 23 Apr 2024 22:41:58 +0200 Subject: [PATCH] Add longPoll parameter to CheckForMessages function --- client/helpers/backgroundHelper.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/helpers/backgroundHelper.go b/client/helpers/backgroundHelper.go index 99bf11b..9f53225 100644 --- a/client/helpers/backgroundHelper.go +++ b/client/helpers/backgroundHelper.go @@ -27,7 +27,7 @@ type ReceivedMessage struct { } // CheckForMessages checks for messages on a single server -func CheckForMessages(storage_path string, job *client.RequestsJob, timeout int) (int, string, error) { +func CheckForMessages(storage_path string, job *client.RequestsJob, timeout int, longPoll bool) (int, string, error) { count := 0 @@ -63,6 +63,11 @@ func CheckForMessages(storage_path string, job *client.RequestsJob, timeout int) var toSrv meowlib.ToServerMessage toSrv.PullRequest = crl toSrv.From = job.Server.UserKp.Public + + if longPoll { + toSrv.Timeout = int64(timeout) + } + data, err := job.Server.ProcessOutboundMessage(&toSrv) if err != nil { return -1, "CheckMessages: ProcessOutboundMessage", err