restructure project
This commit is contained in:
		
							
								
								
									
										31
									
								
								pkg/globals/globals.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								pkg/globals/globals.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| package globals | ||||
|  | ||||
| import ( | ||||
| 	"context" | ||||
| 	"time" | ||||
|  | ||||
| 	"k8s.io/apimachinery/pkg/util/wait" | ||||
| ) | ||||
|  | ||||
| // Did not find any better way for multipackage prefixing | ||||
|  | ||||
| const ( | ||||
| 	PrometheusPrefix       = "logmower" | ||||
| 	AppName                = PrometheusPrefix + "shipper" | ||||
| 	DatabaseCommandTimeout = 10 * time.Second | ||||
| ) | ||||
|  | ||||
| func MongoTimeout(ctx context.Context) context.Context { | ||||
| 	ctx, _ = context.WithTimeout(ctx, DatabaseCommandTimeout) //nolint:lostcancel (cancelled by mongo, should be bug on them //TODO) | ||||
| 	return ctx | ||||
| } | ||||
|  | ||||
| // wrapper to force copying before use | ||||
| func Backoff() wait.Backoff { | ||||
| 	return wait.Backoff{ | ||||
| 		Duration: 2 * time.Second, | ||||
| 		Factor:   1.5, | ||||
| 		Jitter:   0.1, | ||||
| 		Cap:      30 * time.Second, | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user