py-amqp icon indicating copy to clipboard operation
py-amqp copied to clipboard

Distinguish between EINTR and EAGAIN

Open EugeniuZ opened this issue 8 years ago • 3 comments

Looking at this code: https://github.com/celery/py-amqp/blob/master/amqp/transport.py#L364-L366 I understand that socket.timeout() would be raised in 2 cases:

  • drain_events() method is called with some timeout value and no message was received by the consumer in that timeframe
  • process got SIGINT and the recv call was interrupted

Wouldn't it be better if client code can distinguish between the 2 scenarios ?

EugeniuZ avatar Jun 06 '17 13:06 EugeniuZ

what better approach are you suggesting?

auvipy avatar Jun 06 '17 13:06 auvipy

How about raising socket.timeout() for EAGAIN and re-raise socket.error for EINTR ?

EugeniuZ avatar Jun 06 '17 16:06 EugeniuZ

lets discuss a more detail of it here https://groups.google.com/forum/#!forum/celery-users

auvipy avatar Jun 07 '17 06:06 auvipy