Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ Available flags:
- Specifies the number of retries for a scraping task
- Type: unsigned integer
- Default value: `3`
- `-taskretryfront`
- Prepend failed tasks to the front of the queue. If false, failed tasks go to the back of the queue
- Type: boolean
- Default value: `false`
- `-verbose`
- Allows to put the app into verbose mode and print out additional logs to stdout
- Default value: none, no additional output is produced
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func main() {
flagScraperFailurePause := flag.Int("scraperfailurepause", -1, "Amount of time in seconds to wait after a failed task to idle")
flagScraperThrottle := flag.Uint("scraperthrottle", 20, "Maximum number of requests scraper sends per 30 seconds")
flagTaskRetries := flag.Uint("taskretries", 3, "Number of retries for a scraping task")
flagTaskRetryFront := flag.Bool("taskretryfront", false, "Prepend failed tasks to the front of the queue")
flagVerbose := flag.Bool("verbose", false, "Print out additional logs into stdout")
flag.Parse()

Expand Down Expand Up @@ -65,6 +66,7 @@ func main() {
viper.Set("scraperfailurepause", time.Duration(*flagScraperFailurePause)*time.Second)
viper.Set("scraperthrottle", int(*flagScraperThrottle))
viper.Set("taskretries", int(*flagTaskRetries))
viper.Set("taskretryfront", *flagTaskRetryFront)
viper.Set("verbose", *flagVerbose)

cache.InitCache()
Expand Down
2 changes: 1 addition & 1 deletion scraper/handleTaskError.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func handleTaskError(r *colly.Request, blocked bool, err error) {
taskClient,
taskHash,
r.URL.String(),
true,
viper.GetBool("taskretryfront"),
map[string]string{
metadataTaskAddedAt: r.Ctx.Get(metadataTaskAddedAt),
metadataTaskClient: taskClient,
Expand Down