Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added get message with timeout function to mq #14

Merged
merged 1 commit into from

2 participants

@nimajalali

Maintains backward compatibility

@treeder treeder merged commit 25dda30 into from
@treeder
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 20, 2014
  1. @nimajalali
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +7 −0 mq/mq.go
View
7 mq/mq.go
@@ -186,12 +186,19 @@ func (q Queue) Get() (msg *Message, err error) {
// get N messages
func (q Queue) GetN(n int) (msgs []*Message, err error) {
+ msgs, err = q.GetNWithTimeout(n, 0)
+
+ return
+}
+
+func (q Queue) GetNWithTimeout(n, timeout int) (msgs []*Message, err error) {
out := struct {
Messages []*Message `json:"messages"`
}{}
err = q.queues(q.Name, "messages").
QueryAdd("n", "%d", n).
+ QueryAdd("timeout", "%d", timeout).
Req("GET", nil, &out)
if err != nil {
return
Something went wrong with that request. Please try again.