Skip to content

Commit

Permalink
flush event error handling does contain a vbucket
Browse files Browse the repository at this point in the history
Change-Id: I11260857d82acd8b13ca6ab279e9b5439169a019
Reviewed-on: http://review.couchbase.org/19088
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Benjamin Young <benjamin@couchbase.com>
  • Loading branch information
BigBlueHat authored and Benjamin Young committed Jul 31, 2012
1 parent d8e30a1 commit 3ba67f4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions couchbase/couchbaseclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def done(self):
def _respond(self, item, event):
timeout = 30
event.wait(timeout)
if not event.is_set():
if not event.is_set() and 'key' in item:
# if we timeout, then try to reconnect to the server
# responsible for this vbucket
self.restart_vbucket_connection(self.vbucketid(item['key']))
Expand Down Expand Up @@ -436,19 +436,28 @@ def dispatch(self):
# if we get a not_my_vbucket then requeue item
# with fast forward map vbucket
self.log.error(ex)
self.reconfig_callback(ex.vbucket)
self.start_connection_callback(ex.vbucket)
if 'vbucket' in ex:
self.reconfig_callback(ex.vbucket)
self.start_connection_callback(ex.vbucket)
else:
raise Empty
item["fastforward"] = True
self.queue.put(item)
except EOFError, ex:
# we go an EOF error, restart the connection
self.log.error(ex)
self.restart_connection_callback(ex.vbucket)
if 'vbucket' in ex:
self.restart_connection_callback(ex.vbucket)
else:
raise Empty
self.queue.put(item)
except socket.error, ex:
# we got a socket error, restart the connection
self.log.error(ex)
self.restart_connection_callback(ex.vbucket)
if 'vbucket' in ex:
self.restart_connection_callback(ex.vbucket)
else:
raise Empty
self.queue.put(item)

except Empty:
Expand Down

0 comments on commit 3ba67f4

Please sign in to comment.