manage http timeout to allow long poll
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@ -27,7 +27,7 @@ type ReceivedMessage struct {
|
||||
}
|
||||
|
||||
// CheckForMessages checks for messages on a single server
|
||||
func CheckForMessages(storage_path string, job *client.RequestsJob) (int, string, error) {
|
||||
func CheckForMessages(storage_path string, job *client.RequestsJob, timeout int) (int, string, error) {
|
||||
|
||||
count := 0
|
||||
|
||||
@ -68,7 +68,7 @@ func CheckForMessages(storage_path string, job *client.RequestsJob) (int, string
|
||||
return -1, "CheckMessages: ProcessOutboundMessage", err
|
||||
}
|
||||
|
||||
response, err := meowlib.HttpPostMessage(job.Server.Url, data)
|
||||
response, err := meowlib.HttpPostMessage(job.Server.Url, data, timeout)
|
||||
if err != nil {
|
||||
return -1, "CheckMessages: httpPostMessage", err
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"forge.redroom.link/yves/meowlib/client"
|
||||
)
|
||||
|
||||
func HttpSendMessage(serverUid string, message []byte) ([]byte, error) {
|
||||
func HttpSendMessage(serverUid string, message []byte, timeout int) ([]byte, error) {
|
||||
id := client.GetConfig().GetIdentity()
|
||||
srv, err := id.MessageServers.LoadServer(serverUid)
|
||||
if err != nil {
|
||||
@ -22,7 +22,7 @@ func HttpSendMessage(serverUid string, message []byte) ([]byte, error) {
|
||||
id.MessageServers.StoreServer(srv)
|
||||
}
|
||||
|
||||
response, err := meowlib.HttpPostMessage(srv.Url, message)
|
||||
response, err := meowlib.HttpPostMessage(srv.Url, message, timeout)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user