@@ -40,6 +40,8 @@ import (
40
40
admin "google.golang.org/api/admin/directory/v1"
41
41
)
42
42
43
+ const waitSecOnQuotaExceeded = 70
44
+
43
45
// Global variable to deal with GroupsListCall Pages constraint: no possible to pass variable to the function in pages()
44
46
// https://pkg.go.dev/google.golang.org/api/admin/directory/v1?tab=doc#GroupsListCall.Pages
45
47
var ancestors []string
@@ -311,6 +313,19 @@ func EntryPoint(ctxEvent context.Context, PubSubMessage gps.PubSubMessage, globa
311
313
// pages function except just the name of the callback function. Not an invocation of the function
312
314
err = global .dirAdminService .Members .List (feedMessageGroup .Asset .Resource .Id ).MaxResults (global .maxResultsPerPage ).Pages (ctx , browseMembers )
313
315
if err != nil {
316
+ if strings .Contains (strings .ToLower (err .Error ()), "quota" ) {
317
+ log .Println (glo.Entry {
318
+ MicroserviceName : global .microserviceName ,
319
+ InstanceName : global .instanceName ,
320
+ Environment : global .environment ,
321
+ Severity : "WARNING" ,
322
+ Message : fmt .Sprintf ("waiting_on_quota_exceeded" ),
323
+ Description : fmt .Sprintf ("ListGroupMembers quota is gone, wait for %d seconds then retry" , waitSecOnQuotaExceeded ),
324
+ TriggeringPubsubID : global .PubSubID ,
325
+ })
326
+ time .Sleep (waitSecOnQuotaExceeded * time .Second )
327
+ return err
328
+ }
314
329
log .Println (glo.Entry {
315
330
MicroserviceName : global .microserviceName ,
316
331
InstanceName : global .instanceName ,
0 commit comments