{"action":"created","issue":{"url":"https://api.github.com/repos/slolam/XecMe/issues/5","repository_url":"https://api.github.com/repos/slolam/XecMe","labels_url":"https://api.github.com/repos/slolam/XecMe/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/slolam/XecMe/issues/5/comments","events_url":"https://api.github.com/repos/slolam/XecMe/issues/5/events","html_url":"https://github.com/slolam/XecMe/issues/5","id":185412012,"number":5,"title":"Scheduled task runs twice sometimes.","user":{"login":"konuch","id":6041136,"avatar_url":"https://avatars.githubusercontent.com/u/6041136?v=3","gravatar_id":"","url":"https://api.github.com/users/konuch","html_url":"https://github.com/konuch","followers_url":"https://api.github.com/users/konuch/followers","following_url":"https://api.github.com/users/konuch/following{/other_user}","gists_url":"https://api.github.com/users/konuch/gists{/gist_id}","starred_url":"https://api.github.com/users/konuch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/konuch/subscriptions","organizations_url":"https://api.github.com/users/konuch/orgs","repos_url":"https://api.github.com/users/konuch/repos","events_url":"https://api.github.com/users/konuch/events{/privacy}","received_events_url":"https://api.github.com/users/konuch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-26T14:35:26Z","updated_at":"2016-10-27T11:50:52Z","closed_at":null,"body":"My application is hosted on azure as a web app. During start up it initializes scheduled tasks using XecMe which is located in another assembly. My scheduled task is configured to send me an email every day at 00:00. Once in a while I happen to receive two emails per given day.\r\nHere's my config class:\r\n```\r\nnamespace XecMeTest\r\n{\r\n    public static class XecMeTest\r\n    {\r\n        private static bool _initialized;\r\n\r\n        // Initialize scheduled task manager\r\n        public static void Init()\r\n        {\r\n            if (!_initialized)\r\n            {\r\n                var config = new FlowConfiguration();\r\n\r\n                //task to run every day starting from today\r\n                config.ScheduledTask<DailyTasks>(\"DailyTasks\", LogType.Information)\r\n                    .RunDaily()\r\n                    .RepeatEvery(1) // every day\r\n                    .StartsFrom(DateTime.Today)\r\n                    .RunsAt(TimeSpan.Parse(\"00:00\"))\r\n                    .OfTimeZone(\"Central Europe Standard Time\")  //use Central Europe Standard Time or Pacific Standard Time \r\n                    .Add();\r\n\r\n                TaskManager.Start(config);\r\n\r\n                _initialized = true;\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\nAnd here's my daily tasks class:\r\n```\r\nnamespace Tasks\r\n{\r\n    public class DailyTasks : Task\r\n    {\r\n        public override ExecutionState OnExecute(ExecutionContext context)\r\n        {\r\n            //Here I'm sending the email.\r\n            sendMeAnEmail();\r\n\r\n            return base.OnExecute(context);\r\n        }\r\n    }\r\n\r\n    public class Task : ITask\r\n    {\r\n        public virtual void OnStart(ExecutionContext context){ }\r\n        public virtual void OnStop(ExecutionContext context) { }\r\n        public virtual void OnUnhandledException(Exception e){ }\r\n        public virtual ExecutionState OnExecute(ExecutionContext context)\r\n        {\r\n            return ExecutionState.Executed;\r\n        }\r\n    }\r\n}\r\n```\r\nDo you have an idea why this keeps happening?"},"comment":{"url":"https://api.github.com/repos/slolam/XecMe/issues/comments/256619979","html_url":"https://github.com/slolam/XecMe/issues/5#issuecomment-256619979","issue_url":"https://api.github.com/repos/slolam/XecMe/issues/5","id":256619979,"user":{"login":"konuch","id":6041136,"avatar_url":"https://avatars.githubusercontent.com/u/6041136?v=3","gravatar_id":"","url":"https://api.github.com/users/konuch","html_url":"https://github.com/konuch","followers_url":"https://api.github.com/users/konuch/followers","following_url":"https://api.github.com/users/konuch/following{/other_user}","gists_url":"https://api.github.com/users/konuch/gists{/gist_id}","starred_url":"https://api.github.com/users/konuch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/konuch/subscriptions","organizations_url":"https://api.github.com/users/konuch/orgs","repos_url":"https://api.github.com/users/konuch/repos","events_url":"https://api.github.com/users/konuch/events{/privacy}","received_events_url":"https://api.github.com/users/konuch/received_events","type":"User","site_admin":false},"created_at":"2016-10-27T11:50:52Z","updated_at":"2016-10-27T11:50:52Z","body":"Hey, thanks for the ideas. I've included the instance ID into the email message and also enabled logging based on your example. We post the data as soon as it occurs.\r\nTip: Maybe it would be worth including the logging example into readme, just my 2 cents :)\r\n\r\nThanks."}}
{"actor":{"display_login":"konuch"}}