|
|
@ -18,11 +18,12 @@ import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
"crypto/sha256"
|
|
|
|
"crypto/sha256"
|
|
|
|
"encoding/hex"
|
|
|
|
"encoding/hex"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options"
|
|
|
|
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
"sync"
|
|
|
|
"sync"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache"
|
|
|
|
"github.com/openimsdk/tools/errs"
|
|
|
|
"github.com/openimsdk/tools/errs"
|
|
|
@ -91,6 +92,16 @@ func (g *Client) Push(ctx context.Context, userIDs []string, title, content stri
|
|
|
|
for i, v := range s.GetSplitResult() {
|
|
|
|
for i, v := range s.GetSplitResult() {
|
|
|
|
go func(index int, userIDs []string) {
|
|
|
|
go func(index int, userIDs []string) {
|
|
|
|
defer wg.Done()
|
|
|
|
defer wg.Done()
|
|
|
|
|
|
|
|
for i := 0; i < len(userIDs); i += maxNum {
|
|
|
|
|
|
|
|
end := i + maxNum
|
|
|
|
|
|
|
|
if end > len(userIDs) {
|
|
|
|
|
|
|
|
end = len(userIDs)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if err = g.batchPush(ctx, token, userIDs[i:end], pushReq); err != nil {
|
|
|
|
|
|
|
|
log.ZError(ctx, "batchPush failed", err, "index", index, "token", token, "req", pushReq)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
if err = g.batchPush(ctx, token, userIDs, pushReq); err != nil {
|
|
|
|
if err = g.batchPush(ctx, token, userIDs, pushReq); err != nil {
|
|
|
|
log.ZError(ctx, "batchPush failed", err, "index", index, "token", token, "req", pushReq)
|
|
|
|
log.ZError(ctx, "batchPush failed", err, "index", index, "token", token, "req", pushReq)
|
|
|
|
}
|
|
|
|
}
|
|
|
|