Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

network: clean shutdown for Fetcher is impossible #1148

@frncmx

Description

@frncmx

Problem

FetcherFactory.New() starts a goroutine (go fetcher.run()) without providing a way to wait for that goroutine to finish on shutdown. Basically, Fetcher.run() crashes randomly on every shutdown. What kind of problem that can cause?

Solution

FetcherFactory.New() must return quit channel. When context is cancelled to initiate the shutdown, that channel must be closed eventually.

Then the wait for that shutdown signal must be implemented at every place where New() is called. Including TestFetcherFactory.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions