with better closer
This commit is contained in:
33
example/app/main.go
Normal file
33
example/app/main.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user