Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

LogEvent uses a context.TODO() #775

Closed
squaremo opened this issue Oct 5, 2017 · 2 comments
Closed

LogEvent uses a context.TODO() #775

squaremo opened this issue Oct 5, 2017 · 2 comments
Labels
help wanted refactor review Issues that need a review

Comments

@squaremo
Copy link
Member

squaremo commented Oct 5, 2017

The upstream API method LogEvent accepts a context, but when we use it we pass context..TODO(). I left it like this because it was not trivial, and not in the critical path of #759.

At some point it ought to be changed so that a context is passed through -- the main impediment is that the method also forms part of the EventWriter interface, where it doesn't make as much sense to include a context. It may turn out that interface isn't really necessary though.

@squaremo squaremo added the review Issues that need a review label Jun 5, 2018
@kingdonb
Copy link
Member

kingdonb commented Apr 6, 2021

I found the code in question:

func (a *Upstream) LogEvent(event event.Event) error {
return a.apiClient.LogEvent(context.TODO(), event)
}

It may not be in scope for maintenance to resolve this, but I thought it wouldn't do to close it without at least locating the specific code in question.

@kingdonb
Copy link
Member

I've added more context.TODO() in #3515 – I'd love to understand the purpose of context, I haven't really worked with this before.

I found http://p.agnihotry.com/post/understanding_the_context_package_in_golang/ which does a decent job explaining.

I think that any new context-driven features would be necessarily new features, and since Flux v1 in maintenance mode won't add new features, I'm not sure it's necessary to go any further down this road for now. I had to add TODO contexts in a few places in order to satisfy the requirements of the Kubernetes 1.21 client upgrade, but I won't use them for anything.

With all that in mind I think we can close this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted refactor review Issues that need a review
Projects
None yet
Development

No branches or pull requests

2 participants