with better closer

This commit is contained in:
2022-09-10 01:39:36 +02:00
parent 6169d05b3e
commit 4214259591
3 changed files with 46 additions and 8 deletions

33
example/app/main.go Normal file
View File

@@ -0,0 +1,33 @@
package main
import (
"context"
"fmt"
"time"
"git.front.kjuulh.io/kjuulh/curre"
)
func main() {
curre.NewManager().
Register(&httpServer{}).
Register(&httpServer{}).
Register(&httpServer{}).
Run(context.Background())
}
type httpServer struct{}
func (hs *httpServer) Init(ctx context.Context) error { return nil }
func (hs *httpServer) Start(ctx context.Context) error {
for {
fmt.Println(fmt.Sprintf("server: %T, %s", hs, time.Now().String()))
time.Sleep(time.Second * 5)
}
return nil
}
func (hs *httpServer) Close(ctx context.Context) error {
return nil
}