bcoe/karait — Issue #7: visibility_timeout NOT WORK?!
Author: ZoomQuiet
Created: 2011-12-01 03:34:34+00:00
State: open

as doc, i guess the visibility_timeout will auto recover overtime message process?!

- so i expected as:

```python
queue = Queue()
msg = queue.read(routing_key='for_bar',visibility_timeout=1.0)[0]
time.sleep(3)
msg.delete()

# throw out some error here! so i know process timeover!
```

- but in my case:

```python
msg = queue.read(routing_key='for_bar',visibility_timeout=1.0)[0]
print "msg.is_expired()", msg.is_expired()
print CCFG.CONNFAD['karait']['messages'].find_one({'sid':msg.sid}
,{'_id':0,'sid':1,'_meta.expire':1,'_meta.expired':1,'_meta.visible_after':1})
time.sleep(3)
print time.time()
print "msg.is_expired()", msg.is_expired()
print CCFG.CONNFAD['karait']['messages'].find_one({'sid':msg.sid}
,{'_id':0,'sid':1,'_meta.expire':1,'_meta.expired':1,'_meta.visible_after':1})
msg.delete()
print "msg.is_expired()", msg.is_expired()
print CCFG.CONNFAD['karait']['messages'].find_one({'sid':msg.sid}
,{'_id':0,'sid':1,'_meta.expire':1,'_meta.expired':1,'_meta.visible_after':1})

```

export is:

```
1322708234.24
msg.is_expired() False
{u'_meta': {u'visible_after': 1322708235.236205, u'expire': -1.0, u'expired': False}, u'sid': u'0002679'}
1322708237.32
msg.is_expired() False
{u'_meta': {u'visible_after': 1322708235.236205, u'expire': -1.0, u'expired': False}, u'sid': u'0002679'}
msg.is_expired() False
{u'_meta': {u'visible_after': 1322708235.236205, u'expire': -1.0, u'expired': True}, u'sid': u'0002679'}
```

- checked code,i guess:

- c is just worked one time when __init__()
- and only check _meta.expire with _meta.timestamp
- but the visibility_timeout only update into visible_after, NOT relation with is_expired()
- means:

- is_expired equal message.delete()
- visibility_timeout never checked, just update visible_after,make next read() cancel this message

- so that is unacceptable ;-(

- for the word means
- visibility_timeout JUST should work as:

- when read() the message, but timeover, THROW ERROR for it!
- when realy timeover, the message NEED recovered as normoal message, can read out by other process

that all