34 lines
585 B
Go
34 lines
585 B
Go
|
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
|
||
|
}
|