Added delay for messages
This commit is contained in:
@@ -117,6 +117,11 @@ func Init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
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()
|
defer wg.Done()
|
||||||
|
|
||||||
client, err := xmpp.NewClient(&xmppClient.Config, xmppService.Router, errorHandler)
|
client, err := xmpp.NewClient(&xmppClient.Config, xmppService.Router, errorHandler)
|
||||||
@@ -146,6 +151,12 @@ func Init() {
|
|||||||
|
|
||||||
// SendOnlinePresenceStanza - send online presence stnza with data, to server
|
// SendOnlinePresenceStanza - send online presence stnza with data, to server
|
||||||
func SendOnlinePresenceStanza(client *xmpp.Client, jid string) error {
|
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 := stanza.NewPresence(stanza.Attrs{From: jid, Type: stanza.StanzaType(stanza.PresenceShowChat)})
|
||||||
onlinePresencePacket.Status = rolingStockPresenceMessage
|
onlinePresencePacket.Status = rolingStockPresenceMessage
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user