Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Commit

Permalink
fix: resolve query issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Dec 5, 2020
1 parent 23455f3 commit 030e003
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scrap/db.go
Expand Up @@ -131,7 +131,8 @@ func (i *Scraper) dbDiscoveryList(ctx context.Context) ([]string, error) {

func (i *Scraper) dbDiscoveryFetchNext(ctx context.Context) ([]string, error) {
var slugs []string
if err := i.db.SelectContext(ctx, &slugs, "SELECT slug FROM repositories WHERE last_scrapped_at < $1 AND error_code=0 ORDER BY last_scrapped_at, id ASC LIMIT 500", time.Now().Add(-i.refreshEvery).UTC()); err != nil {
_, interval := i.scrapEvery(time.Now())
if err := i.db.SelectContext(ctx, &slugs, fmt.Sprintf("SELECT slug FROM repositories WHERE last_scrapped_at < now() - interval '%s' AND error_code=0 ORDER BY last_scrapped_at, id ASC LIMIT 500", interval)); err != nil {
return nil, errors.WithStack(err)
}

Expand Down

0 comments on commit 030e003

Please sign in to comment.