Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CheckTimeout function #11

Closed
wants to merge 1 commit into from
Closed

Add CheckTimeout function #11

wants to merge 1 commit into from

Conversation

fortytw2
Copy link
Owner

@fortytw2 fortytw2 commented Dec 4, 2016

Allows for a configurable timeout without changing the previously exposed API :)

closes #5

cc/ @lukechampine @bradleyfalzon

@lukechampine
Copy link

This looks good, but it's still not very pretty if you want to use a channel or something else to trigger the check. Now that we have CheckTimeout, it's at least possible to run the check immediately via CheckTimeout(t, 0) -- it's just ugly.

I'm not sure what the best solution is, but perhaps look into the context package? If you had a CheckContext function, then you could do:

ctx, _ := context.WithTimeout(5 * time.Second)
defer leaktest.CheckContext(ctx)()

But since it's a context, you'd have many other ways of triggering it as well.

@fortytw2
Copy link
Owner Author

fortytw2 commented Dec 5, 2016

Hmmmm, that's a really interesting idea - I'll give it a shot later today, thanks for the input! 😃

@fortytw2
Copy link
Owner Author

Replaced by #12

@fortytw2 fortytw2 closed this May 13, 2017
@fortytw2 fortytw2 deleted the timeouts branch May 13, 2017 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test timeouts
2 participants