Skip to content

Conversation

nikepan
Copy link

@nikepan nikepan commented Feb 22, 2017

Some additional methods for working with queue.
Thats useful, when you need interact with queue items (send stop signal and clear queue)

  • GetItems - getting all items for scan without removing
  • Search - getting items for whit checker func without removing
  • GetItem - getting item by position
  • Clear - clear queue

@aviary2-wf
Copy link

Raven

Number of Findings: 0

@nikepan nikepan changed the title added Queue methods: GetItems, Getitem, Search, Clear added Queue methods: GetItems, GetItem, Search, Clear Feb 22, 2017
@dustinhiatt-wf
Copy link
Contributor

+1

1 similar comment
@brianshannan-wf
Copy link
Collaborator

+1

@brianshannan-wf
Copy link
Collaborator

You'll need to pull in master to get the build to pass @nikepan

@aviary-wf
Copy link

aviary-wf commented Feb 15, 2018

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on HipChat: InfoSec Forum.

@nikepan
Copy link
Author

nikepan commented Feb 15, 2018

Updated

@rmconsole-wf rmconsole-wf changed the title added Queue methods: GetItems, GetItem, Search, Clear RM-27055 added Queue methods: GetItems, GetItem, Search, Clear Feb 15, 2018
@brianshannan-wf
Copy link
Collaborator

+1

tonylambiris pushed a commit to tonylambiris/go-datastructures that referenced this pull request Apr 14, 2018
tonylambiris pushed a commit to tonylambiris/go-datastructures that referenced this pull request Jul 26, 2018
@dustinhiatt-wf
Copy link
Contributor

+1


returnItems := make([]interface{}, 0, length)
for _, item := range *items {
if !checker(item) {

Choose a reason for hiding this comment

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

to me it seems unintuitive that this would return objects that do not pass checker, I'd expect the opposite behavior

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed. This logic should probably be inverted and the name changed to something like matcher.

return nil, false
}

// GetItems returns items in this queue.

Choose a reason for hiding this comment

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

Comment doesn't seem to define the exact behavior.

return nil
}

q.lock.Lock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I realize that this is an ancient PR, but it might be better to do a single deferred unlock here as is done elsewhere in this file.

result = q.GetItems()
assert.Len(t, result, 0)
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you for adding/expanding tests.

@ryanjackson-wf
Copy link
Collaborator

@nikepan

As I have time I am working through this backlog of PRs. Is this still work you wish to move forward with? If so, there are a few items we need to address. If not, I will close this out but possibly incorporate some of your ideas in a future PR.

Please let us know. Thank you for your contribution here.

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.

8 participants