{"action":"created","issue":{"url":"https://api.github.com/repos/slact/nchan/issues/445","repository_url":"https://api.github.com/repos/slact/nchan","labels_url":"https://api.github.com/repos/slact/nchan/issues/445/labels{/name}","comments_url":"https://api.github.com/repos/slact/nchan/issues/445/comments","events_url":"https://api.github.com/repos/slact/nchan/issues/445/events","html_url":"https://github.com/slact/nchan/issues/445","id":300297914,"node_id":"MDU6SXNzdWUzMDAyOTc5MTQ=","number":445,"title":"Websocket client receives all cached messages upon initial connection regardless of buffer length","user":{"login":"danjbh","id":20687081,"node_id":"MDQ6VXNlcjIwNjg3MDgx","avatar_url":"https://avatars0.githubusercontent.com/u/20687081?v=4","gravatar_id":"","url":"https://api.github.com/users/danjbh","html_url":"https://github.com/danjbh","followers_url":"https://api.github.com/users/danjbh/followers","following_url":"https://api.github.com/users/danjbh/following{/other_user}","gists_url":"https://api.github.com/users/danjbh/gists{/gist_id}","starred_url":"https://api.github.com/users/danjbh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danjbh/subscriptions","organizations_url":"https://api.github.com/users/danjbh/orgs","repos_url":"https://api.github.com/users/danjbh/repos","events_url":"https://api.github.com/users/danjbh/events{/privacy}","received_events_url":"https://api.github.com/users/danjbh/received_events","type":"User","site_admin":false},"labels":[{"id":14706,"node_id":"MDU6TGFiZWwxNDcwNg==","url":"https://api.github.com/repos/slact/nchan/labels/testing","name":"testing","color":"f7ff03","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-02-26T16:09:26Z","updated_at":"2018-06-27T20:14:06Z","closed_at":null,"author_association":"NONE","body":"I'm currently testing nchan w/ a Redis back-end and noticed that my websocket clients will receive all messages cached by the app instead of the number I have set in `nchan_message_buffer_length` (with `nchan_subscriber_first_message` set to `oldest`).\r\n\r\nBasically, I need clients who request a specific location to get just the 5 messages in a channel buffer. I'm not sure if it makes a difference, but I am running this inside of Docker (nchan version 1.1.14). If I use the `backup` storage mode, this problem goes away but then I can't scale this app horizontally. \r\n\r\nAlso, I noticed that if I run a `flushall` on Redis after hitting the buffer length, it seems to un-stick the messages somehow (perhaps that's a clue).\r\n\r\nLet me know if there's anything I can do to help track this one down. This is a great piece of software and would be willing to send over a healthy donation if we could get this fixed and into production!\r\n\r\nHere is my config and steps to reproduce...\r\n\r\n```server {\r\n    nchan_use_redis on;\r\n    nchan_redis_url \"redis://redis:6379\";\r\n    nchan_message_buffer_length 5;\r\n    nchan_message_timeout 0;\r\n\r\n    listen       80;\r\n    server_name  localhost;\r\n\r\n    location / {\r\n        root   /usr/share/nginx/html;\r\n        index  index.html index.htm;\r\n    }\r\n\r\n    error_page   500 502 503 504  /50x.html;\r\n    location = /50x.html {\r\n        root   /usr/share/nginx/html;\r\n    }\r\n\r\n    location = /oldest {\r\n      nchan_subscriber websocket;\r\n      nchan_channel_id \"foo\";\r\n      nchan_subscriber_first_message oldest;\r\n    }\r\n\r\n    location = /pub {\r\n      nchan_publisher;\r\n      nchan_channel_id \"foo\";\r\n    }\r\n}\r\n```\r\n\r\n## Steps to reproduce\r\n\r\n1. Use provided config above\r\n2. Write 5 messages to the `foo` channel using the `pub` endpoint (via `curl` or preferred method)\r\n3. Pull the channel via Websocket connection so that it gets cached\r\n4. Write 5 additional messages to the `foo` channel\r\n5. Pull the channel via Websocket and you get all 10 cached messages, from steps 2 and 4.\r\n"},"comment":{"url":"https://api.github.com/repos/slact/nchan/issues/comments/400814097","html_url":"https://github.com/slact/nchan/issues/445#issuecomment-400814097","issue_url":"https://api.github.com/repos/slact/nchan/issues/445","id":400814097,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDgxNDA5Nw==","user":{"login":"slact","id":5745,"node_id":"MDQ6VXNlcjU3NDU=","avatar_url":"https://avatars1.githubusercontent.com/u/5745?v=4","gravatar_id":"","url":"https://api.github.com/users/slact","html_url":"https://github.com/slact","followers_url":"https://api.github.com/users/slact/followers","following_url":"https://api.github.com/users/slact/following{/other_user}","gists_url":"https://api.github.com/users/slact/gists{/gist_id}","starred_url":"https://api.github.com/users/slact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slact/subscriptions","organizations_url":"https://api.github.com/users/slact/orgs","repos_url":"https://api.github.com/users/slact/repos","events_url":"https://api.github.com/users/slact/events{/privacy}","received_events_url":"https://api.github.com/users/slact/received_events","type":"User","site_admin":false},"created_at":"2018-06-27T20:14:06Z","updated_at":"2018-06-27T20:14:06Z","author_association":"OWNER","body":"Err, nope, I just reproduced it. Not fixed yet..."}}
{"actor":{"display_login":"slact"}}