Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

cmd/repo-updater/repos/conf.GetUpdateInterval() can return negative durations (panic: non-positive interval for NewTicker) #3535

Open
sfllaw opened this issue Apr 22, 2019 · 0 comments
Labels
needs-team-triage An issue without an owner. Issues should be labeled with a team's name. Malo's doing this.

Comments

@sfllaw
Copy link

sfllaw commented Apr 22, 2019

  • Sourcegraph version: 3.3.0
  • Platform information: N/A

Steps to reproduce:

  1. In the site config, set
    "repoListUpdateInterval": 9999999999
  2. Restart Sourcegraph

Expected behavior:

The repositories are updated every 9,999,999,999 minutes.

Actual behavior:

repo-updater panics because GetUpdateInterval returns a non-positive duration:
https://github.com/sourcegraph/sourcegraph/blob/89ac13c006da9145efb6d674157865d9643cef71/cmd/repo-updater/repos/conf.go#L9-L15

  1. We should handle the case where v < 0. Conventionally, negative durations for intervals means to wait forever. This means that references to GetUpdateInterval should check this and not actually run their tasks.
  2. We should handle the case where time.Duration(v) * time.Minute exceeds the maximum Duration. See proposal: time/v2: make Duration safer to use golang/go#20757
@malomarrec malomarrec added the needs-team-triage An issue without an owner. Issues should be labeled with a team's name. Malo's doing this. label Sep 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-team-triage An issue without an owner. Issues should be labeled with a team's name. Malo's doing this.
Projects
None yet
Development

No branches or pull requests

2 participants