-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat(ARCO-291): Ordered callbacks #755
base: main
Are you sure you want to change the base?
Conversation
7da6924
to
6dad7b5
Compare
928c7cf
to
0c414d7
Compare
m.callbackQueue.PushBack(entry) | ||
} | ||
|
||
// sortByTimestampAsc sorts the callback queue by timestamp in ascending order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sorting is working in N^2 time I think. Above 10,000 entries this will be a dead code.
Isn't https://github.com/google/btree
an option here? we would simply add items there and not worry about sorting at all. Front would always return smallest (by timestamp).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably this btree package would be faster to sort. But then I need to use another data structure than that linked list which is used here.
There is a maximum of items for the queue so that it cannot have more than 10'000 items:
entriesBufferSize = 10000 |
I could make sure that this value is not exceeded like this for example
func WithBufferSize(size int) func(*SendManager) {
return func(m *SendManager) {
if size >= entriesBufferSize {
m.bufferSize = entriesBufferSize
return
}
m.bufferSize = size
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why linked list? if you had simply slice and just called sort function every time it would be even faster I think. Anyway, you decide. you can resolve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added another commit implementing the send manager not using the linked list but a slice
1eaf2df
to
09bf2cc
Compare
Quality Gate passedIssues Measures |
10cf1ba
to
995fcc9
Compare
995fcc9
to
b3dfacc
Compare
Description of Changes
Testing Procedure
Describe the tests you've added or any testing steps you've taken.
Checklist:
CHANGELOG.md
with my changes