Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
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

Description

@sfllaw
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-team-triageAn issue without an owner. Issues should be labeled with a team's name. Malo's doing this.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions