Log deadlines

This commit is contained in:
Vaibhav Kamra 2023-03-17 12:11:49 -07:00
parent 78f109758c
commit 4c1a6caabf
3 changed files with 27 additions and 0 deletions

View File

@ -103,6 +103,12 @@ func (c Events) GetItem(
event models.Eventable event models.Eventable
) )
if d, ok := ctx.Deadline(); ok {
logger.Ctx(ctx).Infof("GetItem Context is %s\n", d.String())
} else {
logger.Ctx(ctx).Info("GetItem Context has no deadline")
}
event, err = c.stable.Client().UsersById(user).EventsById(itemID).Get(ctx, nil) event, err = c.stable.Client().UsersById(user).EventsById(itemID).Get(ctx, nil)
if err != nil { if err != nil {
return nil, nil, graph.Stack(ctx, err) return nil, nil, graph.Stack(ctx, err)

View File

@ -162,6 +162,8 @@ func (col Collection) DoNotMergeItems() bool {
// Items() channel controller // Items() channel controller
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
var global = 1
// streamItems is a utility function that uses col.collectionType to be able to serialize // streamItems is a utility function that uses col.collectionType to be able to serialize
// all the M365IDs defined in the added field. data channel is closed by this function // all the M365IDs defined in the added field. data channel is closed by this function
func (col *Collection) streamItems(ctx context.Context, errs *fault.Bus) { func (col *Collection) streamItems(ctx context.Context, errs *fault.Bus) {
@ -239,6 +241,18 @@ func (col *Collection) streamItems(ctx context.Context, errs *fault.Bus) {
defer wg.Done() defer wg.Done()
defer func() { <-semaphoreCh }() defer func() { <-semaphoreCh }()
if global == 0 {
log.Infow("Sleeping for 100 seconds")
time.Sleep(110 * time.Second)
global = 1
}
if d, ok := ctx.Deadline(); ok {
log.Infof("Corso Context is %s\n", d.String())
} else {
log.Info("Corso Context has no deadline")
}
item, info, err := getItemWithRetries( item, info, err := getItemWithRetries(
ctx, ctx,
user, user,

View File

@ -6,6 +6,7 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/alcionai/corso/src/pkg/logger"
backoff "github.com/cenkalti/backoff/v4" backoff "github.com/cenkalti/backoff/v4"
khttp "github.com/microsoft/kiota-http-go" khttp "github.com/microsoft/kiota-http-go"
) )
@ -67,6 +68,12 @@ func (middleware RetryHandler) retryRequest(
return nil, Stack(ctx, respErr).With("retry_count", executionCount) return nil, Stack(ctx, respErr).With("retry_count", executionCount)
} }
if d, ok := ctx.Deadline(); ok {
logger.Ctx(ctx).Infof("Context is %s\n", d.String())
} else {
logger.Ctx(ctx).Infow("Context has no deadline")
}
return resp, nil return resp, nil
} }