This commit is contained in:
Bel LaPointe
2025-04-24 21:00:55 -06:00
parent 5a51ebf884
commit c822404bf7
3 changed files with 40 additions and 2 deletions

10
src/cmd/cron.go Normal file
View File

@@ -0,0 +1,10 @@
package cmd
import (
"context"
"io"
)
func cron(ctx context.Context) error {
return io.EOF
}

View File

@@ -2,9 +2,27 @@ package cmd
import (
"context"
"io"
"fmt"
"show-rss/src/pool"
)
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
View File

@@ -0,0 +1,10 @@
package cmd
import (
"context"
"io"
)
func server(ctx context.Context) error {
return io.EOF
}