{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-session/issues/1159","repository_url":"https://api.github.com/repos/spring-projects/spring-session","labels_url":"https://api.github.com/repos/spring-projects/spring-session/issues/1159/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-session/issues/1159/comments","events_url":"https://api.github.com/repos/spring-projects/spring-session/issues/1159/events","html_url":"https://github.com/spring-projects/spring-session/issues/1159","id":351491896,"node_id":"MDU6SXNzdWUzNTE0OTE4OTY=","number":1159,"title":"Provide a way to disable cleanup cron","user":{"login":"saiya","id":1253052,"node_id":"MDQ6VXNlcjEyNTMwNTI=","avatar_url":"https://avatars1.githubusercontent.com/u/1253052?v=4","gravatar_id":"","url":"https://api.github.com/users/saiya","html_url":"https://github.com/saiya","followers_url":"https://api.github.com/users/saiya/followers","following_url":"https://api.github.com/users/saiya/following{/other_user}","gists_url":"https://api.github.com/users/saiya/gists{/gist_id}","starred_url":"https://api.github.com/users/saiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saiya/subscriptions","organizations_url":"https://api.github.com/users/saiya/orgs","repos_url":"https://api.github.com/users/saiya/repos","events_url":"https://api.github.com/users/saiya/events{/privacy}","received_events_url":"https://api.github.com/users/saiya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-17T07:47:29Z","updated_at":"2018-08-17T07:48:28Z","closed_at":null,"author_association":"NONE","body":"Hi, I want a way to disable cleanup cron in Spring Session Data Redis (as described in previous conversation: https://github.com/spring-projects/spring-session/issues/1119#issuecomment-413450799 ).\r\n\r\nHere is a issue that describes about the matter.\r\n\r\n# TL;DR\r\n\r\n- Sometime user want to disable cleanup cron of Spring Session Data Redis and Spring Session JDBC\r\n- There was a known workaround to set `cleanup-cron=0 0 5 31 2` (February 31st, never comes), but it does not work with recent version of spring-context\r\n- It is difficult to override `RedisHttpSessionConfiguration` and `JdbcHttpSessionConfiguration` to prevent cleanup cron.\r\n- What I want is a way to disable cleanup cron. And also enable to use property placeholder in `cleanupCron` attribute.\r\n\r\n# Motivation\r\n\r\nI want to disable cleanup cron because ...\r\n\r\n- use case 1) When I have many web servers, I want to enable cleanup-cron on only one server and want to disable cleanup-cron on other servers to reduce DataStore load and connection pool usage.\r\n- use case 2) When SessionDeletedEvent and SessionExpiredEvent seem not to be needed (also no need to close WebSocket connections associated with the session), I want to disable cleanup-cron entirely.\r\n\r\n# Limitation of current implementation \r\n\r\nAs shown in example code of https://github.com/spring-projects/spring-session/issues/1119#issuecomment-413450799, current `RedisHttpSessionConfiguration` and `JdbcHttpSessionConfiguration` does not formal way to disable cleanup cron.\r\n\r\nMy understanding is that above example code is a only way currently and such way is poor in maintainability.\r\n\r\n# What I want\r\n\r\nMy proposal is to add following attributes to disable cleanup cron:\r\n\r\n- Add `boolean enableCleanupCron = true` optional attribute into `@EnableRedisHttpSession` and `@EnableJdbcHttpSession`\r\n  - Default value is `true`, it is same with existing behavior\r\n  - When it is `false`, `RedisHttpSessionConfiguration` and `JdbcHttpSessionConfiguration` will not register CronTask\r\n- Enable to use property placeholder in `disableCleanupCron` and `cleanupCron` attributes\r\n  - As described in use case A, sometimes user want to vary cleanup cron setting by environment.\r\n  - Use `StringValueResolver` to resolve placeholders seems to be a way to resolve placeholders (current implementation uses it on `redisNamespace` attribute but not on `cleanupCron`).\r\n  - Current `cleanupCron` attribute seems to accept only cron form (e.g. `0 0 5 31 2`). Thus introducing StringValueResolver is not breaking change in my understanding.\r\n"},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-session/issues/comments/413786606","html_url":"https://github.com/spring-projects/spring-session/issues/1159#issuecomment-413786606","issue_url":"https://api.github.com/repos/spring-projects/spring-session/issues/1159","id":413786606,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzc4NjYwNg==","user":{"login":"saiya","id":1253052,"node_id":"MDQ6VXNlcjEyNTMwNTI=","avatar_url":"https://avatars1.githubusercontent.com/u/1253052?v=4","gravatar_id":"","url":"https://api.github.com/users/saiya","html_url":"https://github.com/saiya","followers_url":"https://api.github.com/users/saiya/followers","following_url":"https://api.github.com/users/saiya/following{/other_user}","gists_url":"https://api.github.com/users/saiya/gists{/gist_id}","starred_url":"https://api.github.com/users/saiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saiya/subscriptions","organizations_url":"https://api.github.com/users/saiya/orgs","repos_url":"https://api.github.com/users/saiya/repos","events_url":"https://api.github.com/users/saiya/events{/privacy}","received_events_url":"https://api.github.com/users/saiya/received_events","type":"User","site_admin":false},"created_at":"2018-08-17T07:48:28Z","updated_at":"2018-08-17T07:48:28Z","author_association":"NONE","body":"I will try to make a pull request in a way as described above.\r\nIf someone have a opinion, please tell me."}}
{"actor":{"display_login":"saiya"}}