{"action":"opened","issue":{"url":"https://api.github.com/repos/logstash-plugins/logstash-input-file/issues/58","labels_url":"https://api.github.com/repos/logstash-plugins/logstash-input-file/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/logstash-plugins/logstash-input-file/issues/58/comments","events_url":"https://api.github.com/repos/logstash-plugins/logstash-input-file/issues/58/events","html_url":"https://github.com/logstash-plugins/logstash-input-file/issues/58","id":92441876,"number":58,"title":"Redundant sincedb_write in teardown","user":{"login":"kelvinfann","id":7586789,"avatar_url":"https://avatars.githubusercontent.com/u/7586789?v=3","gravatar_id":"","url":"https://api.github.com/users/kelvinfann","html_url":"https://github.com/kelvinfann","followers_url":"https://api.github.com/users/kelvinfann/followers","following_url":"https://api.github.com/users/kelvinfann/following{/other_user}","gists_url":"https://api.github.com/users/kelvinfann/gists{/gist_id}","starred_url":"https://api.github.com/users/kelvinfann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kelvinfann/subscriptions","organizations_url":"https://api.github.com/users/kelvinfann/orgs","repos_url":"https://api.github.com/users/kelvinfann/repos","events_url":"https://api.github.com/users/kelvinfann/events{/privacy}","received_events_url":"https://api.github.com/users/kelvinfann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-01T17:35:21Z","updated_at":"2015-07-01T17:35:21Z","closed_at":null,"body":"Nothing big but it is redundant and a bit misleading. \r\n\r\nIn the `teardown` function:\r\n```\r\npublic\r\ndef teardown\r\n  if @tail\r\n    @tail.sincedb_write\r\n    @tail.quit\r\n    @tail = nil\r\n  end\r\nend # def teardown\r\n```\r\n\r\n`@tail.sincedb_write` is called right before a `@tail.quit`\r\nIf you look into the [Filewatch Tail Code](https://github.com/jordansissel/ruby-filewatch/blob/master/lib/filewatch/tail.rb), you'll find that `@tail.quit` calls  `@tail._sincedb_write`\r\n\r\n```\r\n# from filewatch/tail.rb\r\npublic\r\ndef quit\r\n  _sincedb_write\r\n  @watch.quit\r\nend # def quit\r\n```\r\n\r\nWhich is essential `@tail.sincedb_write` except with a logger statement.\r\n```\r\n# from filewatch/tail.rb\r\npublic\r\ndef sincedb_write(reason=nil)\r\n  @logger.debug? && @logger.debug(\"caller requested sincedb write (#{reason})\")\r\n  _sincedb_write\r\nend\r\n```\r\n\r\nI am not sure if this was done purposefully to have that debugging statement, but the redundant code is misleading. It makes it seem that the `@watch.quit` does not write to the file when it does. At the very least, it caught me off guard when I was trying to further extend the file plugin for my own use case. "}}