more stuff

This commit is contained in:
Richard Patel
2018-10-28 03:41:16 +01:00
parent 4ea5f8a410
commit faad19f121
4 changed files with 34 additions and 10 deletions

View File

@@ -10,11 +10,15 @@ type Job struct {
Uri url.URL
UriStr string
Fails int
LastError error
}
func Schedule(c context.Context, remotes <-chan *RemoteDir) {
in, out := makeJobBuffer()
wCtx := WorkerContext{ in, out }
wCtx := WorkerContext{
in: in,
out: out,
}
for i := 0; i < config.Workers; i++ {
go wCtx.Worker()
}
@@ -28,7 +32,7 @@ func Schedule(c context.Context, remotes <-chan *RemoteDir) {
case remote := <-remotes:
// Enqueue initial job
queueJob(in, Job{
wCtx.queueJob(Job{
Remote: remote,
Uri: remote.BaseUri,
UriStr: remote.BaseUri.String(),