Skip to content

Don't block lock in forSeriesMatching callback#1233

Merged
tomwilkie merged 3 commits intocortexproject:masterfrom
codesome:ingester-lock
Mar 13, 2019
Merged

Don't block lock in forSeriesMatching callback#1233
tomwilkie merged 3 commits intocortexproject:masterfrom
codesome:ingester-lock

Conversation

@codesome
Copy link
Contributor

stream.Send here

err = stream.Send(&client.QueryStreamResponse{
Timeseries: batch,
})
is time consuming, in-turn blocking the lock in forSeriesMatching.

This PR breaks the callbacks into 2 callbacks, where second callback is called in intervals outside the critical sections of the lock.

  • Unit tests

/cc @tomwilkie

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
@tomwilkie
Copy link
Contributor

Looks good @codesome! Left some feedback. I'm actually going to deploy and test this, so might do the feedback myself if thats okay.

@codesome
Copy link
Contributor Author

@tomwilkie I'll be unavailable for ~35h from now (got a long flight ahead), so please go ahead!

@codesome
Copy link
Contributor Author

PS: As this function was used elsewhere too where there was no notion of batch, send etc, I tried to keep the names more general.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
@codesome codesome marked this pull request as ready for review March 8, 2019 14:17
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
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.

4 participants