X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/790279faf0fda789d93a75f6f5996e65d5de4a18..59948b44c0fe2165b90e3aa0d18646f6c3d74af3:/whatsapp_groups.go diff --git a/whatsapp_groups.go b/whatsapp_groups.go index ec5c892..6e9bed3 100644 --- a/whatsapp_groups.go +++ b/whatsapp_groups.go @@ -9,6 +9,10 @@ import ( ) const ( + // whatsappGroupLookupTimeout is the longest time of a read of group + // names. + whatsappGroupLookupTimeout = 10 * time.Second + // whatsappGroupsRefresh is the shortest time between two reads of the // groups from WhatsApp for a group with no name. whatsappGroupsRefresh = time.Minute @@ -77,7 +81,7 @@ func (g *WhatsAppGroups) read(ctx context.Context, link WhatsAppLink) bool { return false } - ctx, cancel := context.WithTimeout(ctx, whatsappLookupTime) + ctx, cancel := context.WithTimeout(ctx, whatsappGroupLookupTimeout) defer cancel() groups, err := link.client.GetJoinedGroups(ctx)