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

Buffered channels #89

Merged
merged 6 commits into from
May 15, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions internal/extractors/extract_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import (
// ExtractFunction is the type of the ExtractData function
type ExtractFunction func(callback common.Callback, streamBatch ...StreamBatch)

const channelBufferSize int = 1000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit-picking here, but are re there any cache chunk related reasons to think that 1024 might be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it looks better :)


// ExtractData reads Ramses data packages and extract the instrument data.
func ExtractData(callback common.Callback, streamBatch ...StreamBatch) {
var waitGroup sync.WaitGroup
ramsesChannel := make(chan common.DataRecord)
innosatChannel := make(chan common.DataRecord)
aggregatorChannel := make(chan common.DataRecord)
aezChannel := make(chan common.DataRecord)
ramsesChannel := make(chan common.DataRecord, channelBufferSize)
innosatChannel := make(chan common.DataRecord, channelBufferSize)
aggregatorChannel := make(chan common.DataRecord, channelBufferSize)
aezChannel := make(chan common.DataRecord, channelBufferSize)

go DecodeRamses(ramsesChannel, streamBatch...)
go Aggregator(aggregatorChannel, innosatChannel)
Expand Down