Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

push_delete_oldest_received_message should respect push_min_message_b…

…uffer_length
  • Loading branch information...
commit 203cbc7d5a921b90b0817d7ca3080e458bbd3419 1 parent 68fbf06
@slact authored
View
6 README
@@ -86,8 +86,10 @@ push_delete_oldest_received_message [ on | off ]
default: off
context: http, server, location
When enabled, as soon as the oldest message in a channel's message queue has
- been received by a subscriber, it is deleted. Recommend avoiding this
- directive as it violates subscribers' assumptions of GET request idempotence.
+ been received by a subscriber, it is deleted -- provided there are more than
+ push_min_message_buffer_length messages in the channel's message buffer.
+ Recommend avoiding this directive as it violates subscribers' assumptions of
+ GET request idempotence.
push_message_timeout [ time ]
default: 1h
View
5 src/ngx_http_push_module.c
@@ -95,7 +95,7 @@ static void ngx_http_push_release_message_locked(ngx_http_push_channel_t *channe
//message had been dequeued and nobody needs it anymore
ngx_http_push_free_message_locked(msg, ngx_http_push_shpool);
}
- if(msg->delete_oldest_received>=0 && ngx_http_push_get_oldest_message_locked(channel) == msg) {
+ if(channel->messages > msg->delete_oldest_received_min_messages && ngx_http_push_get_oldest_message_locked(channel) == msg) {
ngx_http_push_delete_message_locked(channel, msg, ngx_http_push_shpool);
}
}
@@ -684,7 +684,8 @@ static void ngx_http_push_publisher_body_handler(ngx_http_request_t * r) {
time_t message_timeout = cf->buffer_timeout;
msg->expires = (message_timeout==0 ? 0 : (ngx_time() + message_timeout));
- msg->delete_oldest_received = cf->delete_oldest_received_message;
+ msg->delete_oldest_received_min_messages = cf->delete_oldest_received_message ? (ngx_uint_t) cf->min_messages : NGX_MAX_UINT32_VALUE;
+ //NGX_MAX_UINT32_VALUE to disable, otherwise = min_message_buffer_size of the publisher location from whence the message came
//FMI (For My Information): shm is still locked.
switch(ngx_http_push_broadcast_message_locked(channel, msg, r->connection->log, shpool)) {
View
2  src/ngx_http_push_module.h
@@ -71,7 +71,7 @@ typedef struct {
// ngx_str_t charset;
ngx_buf_t *buf;
time_t expires;
- ngx_int_t delete_oldest_received;
+ ngx_uint_t delete_oldest_received_min_messages; //NGX_MAX_UINT32_VALUE for 'never'
time_t message_time; //tag message by time
ngx_int_t message_tag; //used in conjunction with message_time if more than one message have the same time.
ngx_int_t refcount;
Please sign in to comment.
Something went wrong with that request. Please try again.