stub
This commit is contained in:
10
src/cmd/cron.go
Normal file
10
src/cmd/cron.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
func cron(ctx context.Context) error {
|
||||||
|
return io.EOF
|
||||||
|
}
|
||||||
@@ -2,9 +2,27 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"fmt"
|
||||||
|
"show-rss/src/pool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Main(ctx context.Context) error {
|
func Main(ctx context.Context) error {
|
||||||
return io.EOF
|
ctx, can := context.WithCancel(ctx)
|
||||||
|
defer can()
|
||||||
|
|
||||||
|
foos := map[string]func() error{
|
||||||
|
"server": func() error { return server(ctx) },
|
||||||
|
"cron": func() error { return cron(ctx) },
|
||||||
|
}
|
||||||
|
p := pool.New(len(foos))
|
||||||
|
defer p.Wait(ctx)
|
||||||
|
|
||||||
|
for k, foo := range foos {
|
||||||
|
foo := foo
|
||||||
|
if err := p.Go(ctx, k, foo); err != nil {
|
||||||
|
return fmt.Errorf("failed to go %s: %v", k, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return p.Wait(ctx)
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/cmd/server.go
Normal file
10
src/cmd/server.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
func server(ctx context.Context) error {
|
||||||
|
return io.EOF
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user