File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed
Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,12 @@ def remove_queue(self, queue):
173173 self .redis .srem ('resque:queues' ,queue )
174174 del self .redis ['resque:queue:%s' % queue ]
175175
176+ def close (self ):
177+ """
178+ close the underlying redis connection
179+ """
180+ self .redis .disconnect ()
181+
176182 @classmethod
177183 def encode (cls , item ):
178184 return simplejson .dumps (item )
Original file line number Diff line number Diff line change 1414 Worker
1515)
1616
17- HOST = "localhost:6379"
17+ HOST = ResQ ( "localhost:6379" )
1818MY_ROOT = os .path .join (os .path .dirname (__file__ ), 'media' )
1919#resq = ResQ(HOST)
2020
Original file line number Diff line number Diff line change @@ -9,9 +9,12 @@ class ResWeb(pystache.View):
99 template_path = TEMPLATE_PATH
1010 def __init__ (self , host ):
1111 super (ResWeb , self ).__init__ ()
12- self .resq = ResQ ( host )
12+ self .resq = host
1313 def media_folder (self ):
1414 return '/media/'
15+ def close (self ):
16+ self .resq .close ()
17+
1518 def address (self ):
1619 return '%s:%s' % (self .resq .redis .host ,self .resq .redis .port )
1720 def version (self ):
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22from resweb import server
3- from itty import *
3+ from itty import run_itty
44def main ():
55 from optparse import OptionParser
66 usage = "usage: %prog [options]"
@@ -16,7 +16,8 @@ def main():
1616 parser .add_option ("--dsn" ,dest = "dsn" ,help = "redis server to display" )
1717 (options ,args ) = parser .parse_args ()
1818 if options .dsn :
19- server .HOST = options .dsn
19+ from pyres import ResQ
20+ server .HOST = ResQ (options .dsn )
2021 run_itty (host = options .host , port = options .port )
2122
2223if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments