Skip to content

Commit

Permalink
feat: Add client interceptor
Browse files Browse the repository at this point in the history
- Add client interceptor
 #16
  • Loading branch information
lc-1010 committed Jul 16, 2023
1 parent f7bd795 commit d041bfe
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/internal/middleware/client_interceptor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package middleware

import (
"context"
"time"
)

func defaultContextTimeout(ctx context.Context) (context.Context, context.CancelFunc) {
var cancel context.CancelFunc
if _, ok := ctx.Deadline(); !ok {
defaultTimeout := 60 * time.Second
ctx, cancel = context.WithTimeout(ctx, defaultTimeout)
}
return ctx, cancel
}

0 comments on commit d041bfe

Please sign in to comment.