mirror of
https://github.com/terorie/od-database-crawler.git
synced 2025-12-13 15:19:03 +00:00
Scheduler
This commit is contained in:
36
main.go
36
main.go
@@ -1,23 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/viper"
|
||||
"context"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
ServerUrl string
|
||||
Token string
|
||||
}
|
||||
|
||||
|
||||
func main2() {
|
||||
var err error
|
||||
|
||||
viper.SetConfigName("config.yml")
|
||||
viper.SetConfigType("yml")
|
||||
err = viper.ReadInConfig()
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
func main() {
|
||||
prepareConfig()
|
||||
readConfig()
|
||||
|
||||
c := context.Background()
|
||||
|
||||
remotes := make(chan *RemoteDir)
|
||||
go Schedule(c, remotes)
|
||||
|
||||
u, _ := url.Parse("http://mine.terorie.com:420/")
|
||||
remote := NewRemoteDir(*u)
|
||||
|
||||
globalWait.Add(1)
|
||||
remotes <- remote
|
||||
|
||||
// Wait for all jobs to finish
|
||||
globalWait.Wait()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user