Skip to content
Snippets Groups Projects
Commit 8ae3acd9 authored by Travis Ralston's avatar Travis Ralston
Browse files

Update tunny in the import script

This requires testing as per #93
parent abc301db
No related branches found
No related tags found
No related merge requests found
...@@ -81,10 +81,7 @@ func main() { ...@@ -81,10 +81,7 @@ func main() {
logrus.Info(fmt.Sprintf("Downloading %d media records", len(records))) logrus.Info(fmt.Sprintf("Downloading %d media records", len(records)))
pool, err := tunny.CreatePool(*numWorkers, fetchMedia).Open() pool := tunny.NewFunc(*numWorkers, fetchMedia)
if err != nil {
panic(err)
}
numCompleted := 0 numCompleted := 0
lock := &sync.RWMutex{} lock := &sync.RWMutex{}
...@@ -101,7 +98,10 @@ func main() { ...@@ -101,7 +98,10 @@ func main() {
record := records[i] record := records[i]
logrus.Info(fmt.Sprintf("Queuing %s (%d/%d %d%%)", record.MediaId, i+1, len(records), percent)) logrus.Info(fmt.Sprintf("Queuing %s (%d/%d %d%%)", record.MediaId, i+1, len(records), percent))
pool.SendWorkAsync(&fetchRequest{media: record, serverName: *serverName, csApiUrl: csApiUrl}, onComplete) go func() {
result := pool.Process(&fetchRequest{media: record, serverName: *serverName, csApiUrl: csApiUrl})
onComplete(result, nil)
}()
} }
for numCompleted < len(records) { for numCompleted < len(records) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment