This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var exitSelectCases []reflect.SelectCase | |
for i := 0; i < readersCount; i++ { | |
r, err := nsq.NewReader(topic, channel) | |
if err != nil { | |
log.Fatalln("nsq.NewReader:", err) | |
} | |
r.SetMaxInFlight(2500) | |
for j := 0; j < workersPerReader; j++ { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func loop(inChan chan *nsq.Message) { | |
for _, msg := range inChan { | |
err := doWork(msg) | |
if err != nil { | |
msg.Requeue(-1) | |
continue | |
} | |
msg.Finish() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tornado.platform.twisted import TwistedIOLoop | |
import tornado.ioloop | |
from twisted.internet import defer, reactor | |
from twisted.application import service | |
import nsq | |
from nsq import Writer, Error | |
from nsq.async import AsyncConn | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
import sys | |
import logging | |
import functools | |
import time | |
import tornado.options | |
import tornado.ioloop | |
import nsq_data | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tornado.httpclient | |
import logging | |
import json | |
import urllib | |
import functools | |
_http_client = None | |
def http_client(): | |
global _http_client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
import sys | |
import logging | |
import functools | |
import time | |
import tornado.options | |
import tornado.ioloop | |
import nsq_data | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am mreiferson on github. | |
* I am snakes (https://keybase.io/snakes) on keybase. | |
* I have a public key whose fingerprint is D95F 8610 1A76 7410 4FD0 F177 D637 0BCE 91EC 464D | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nsq | |
def task1(message): | |
print message | |
return True | |
def task2(message): | |
print message | |
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nsq | |
buf = [] | |
def process_message(message): | |
global buf | |
message.enable_async() | |
buf.append(message) | |
if len(buf) >= 3: | |
for msg in buf: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function j { | |
local project=$1 | |
cd `find ~/dev/src -type d -mindepth 3 -maxdepth 3 -name $project` | |
} |
OlderNewer