Hi Steve,

On Wed, Jan 26, 2011 at 10:00 AM, Steve Kieu <[email protected]> wrote:
> Thanks for the answer.
>
> The problem is that when create a Store object, storm does not try to
> connect right away so no exception is thrown at that point. When there is a
> need, storm try to use the connection and fail. To handle it, I have to wrap
> many try: catch exception all over places and not quite sure where and it
> does not look good.

In most cases you need one try/except at the place where you
application starts processing the request.  Something like:

def receive_request_from_web_server(request, retries=3):
    try:
        handle_request(request)
    except DisconnectionError:
        if retries:
            # Probably want to sleep for a few seconds here, to give
            # the database a chance to recover
            receive_request_from_web_server(request, retries - 1)
        else:
            raise

def handle_request(request):
    # Application logic for the request

> Like a php mysql db, they just don't care, if connection goes away, they
> reconnect / make new connection automatically. That would be be nice

That's not really possible with transactions.  You need to start a new
transaction and perform your operation from scratch.

Thanks,
J.

-- 
storm mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/storm

Reply via email to