Enha: tx for cron
This commit is contained in:
		
							
								
								
									
										4
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.go
									
									
									
									
									
								
							| @@ -62,20 +62,16 @@ func main() { | ||||
| 	// Setup graceful shutdown | ||||
| 	stop := make(chan os.Signal, 1) | ||||
| 	signal.Notify(stop, os.Interrupt, syscall.SIGTERM) | ||||
|  | ||||
| 	repo := repos.NewRepoProvider(cfg.DBPath) | ||||
| 	defer repo.Close() | ||||
|  | ||||
| 	cm := crons.NewCronManager(repo, slog.Default()) | ||||
| 	cm.Start() | ||||
|  | ||||
| 	server := ListenToRequests(cfg.ServerConfig.Port) | ||||
| 	go func() { | ||||
| 		if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed { | ||||
| 			panic(err) | ||||
| 		} | ||||
| 	}() | ||||
|  | ||||
| 	<-stop | ||||
| 	slog.Info("Shutting down server...") | ||||
| 	ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder