Skip to content

Graceful shutdown #12

Open
Open
@burdiyan

Description

I was looking at the code and something caught my attention. I see that instantiating a peer would spin up a goroutine that would wait on the context.Done channel and then close some of the underlying dependencies.

https://github.com/hsanjuan/ipfs-lite/blob/master/ipfs.go#L128

I might be wrong, but it seems like there's no way to wait until this shutdown process is actually finished. The autoclose goroutine is not signaling anywhere when it's done.

Wouldn't it be more correct to provide explicit Close method so that users of ipfs-lite could chose to wait until the peer is actually closed? Another approach could be providing an explicit Start method that would block and could accept a context for being canceled.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions