diff --git a/services/xmppsService.go b/services/xmppsService.go index b32af9e..997f61d 100644 --- a/services/xmppsService.go +++ b/services/xmppsService.go @@ -117,6 +117,11 @@ func Init() { } go func() { + + statusMesageDelay := int64(rand.Intn(appConfig.AppConfig.GeneralOptions.StatusMessageDelay)) + log.Printf("DELAYING FOR: %v", statusMesageDelay*1000000000) + // Delay For two seccond to allow all clients to connect + time.Sleep(time.Duration(statusMesageDelay * 1000000000)) defer wg.Done() client, err := xmpp.NewClient(&xmppClient.Config, xmppService.Router, errorHandler) @@ -146,6 +151,12 @@ func Init() { // SendOnlinePresenceStanza - send online presence stnza with data, to server func SendOnlinePresenceStanza(client *xmpp.Client, jid string) error { + + statusMesageDelay := int64(rand.Intn(appConfig.AppConfig.GeneralOptions.StatusMessageDelay)) + log.Printf("DELAYING FOR: %v", statusMesageDelay*1000000000) + // Delay For two seccond to allow all clients to connect + time.Sleep(time.Duration(statusMesageDelay * 1000000000)) + onlinePresencePacket := stanza.NewPresence(stanza.Attrs{From: jid, Type: stanza.StanzaType(stanza.PresenceShowChat)}) onlinePresencePacket.Status = rolingStockPresenceMessage