<commit_before>﻿using CurrencyRates.Base.Service;
using System.Diagnostics;
using System.ServiceProcess;
using System.Timers;

namespace CurrencyRates.WindowsService
{
    public partial class Scheduler : ServiceBase
    {
        static int EventId;
        readonly Synchronizer Synchronizer;

        public Scheduler(Synchronizer synchronizer)
        {
            Synchronizer = synchronizer;
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            EventLog.WriteEntry(GetType().Name + " started.", EventLogEntryType.Information, ++EventId);

            var timer = new Timer() { Interval = 60000 };
            timer.Elapsed += OnTimer;
            timer.Start();
        }

        protected override void OnStop()
        {
            EventLog.WriteEntry(GetType().Name + " stopped.", EventLogEntryType.Information, ++EventId);
        }

        void OnTimer(object sender, ElapsedEventArgs args)
        {
            Synchronizer.SyncAll();
            EventLog.WriteEntry("Synchronized rates.", EventLogEntryType.Information, ++EventId);
        }
    }<commit_msg>Make interval configurable in Scheduler<commit_after>﻿using CurrencyRates.Base.Service;
using System.Diagnostics;
using System.ServiceProcess;
using System.Timers;

namespace CurrencyRates.WindowsService
{
    public partial class Scheduler : ServiceBase
    {
        static int EventId;
        readonly int Interval;
        readonly Synchronizer Synchronizer;

        public Scheduler(Synchronizer synchronizer, int interval = 60000)
        {
            Synchronizer = synchronizer;
            Interval = interval;
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            EventLog.WriteEntry(GetType().FullName + " started.", EventLogEntryType.Information, ++EventId);

            var timer = new Timer() { Interval = Interval };
            timer.Elapsed += OnTimer;
            timer.Start();
        }

        protected override void OnStop()
        {
            EventLog.WriteEntry(GetType().FullName + " stopped.", EventLogEntryType.Information, ++EventId);
        }

        void OnTimer(object sender, ElapsedEventArgs args)
        {
            Synchronizer.SyncAll();
            EventLog.WriteEntry("Synchronized rates.", EventLogEntryType.Information, ++EventId);
        }
    }
{'fraction_non_alphanumeric': 0.0906081919735209, 'fraction_numerical': 0.004137360364087712, 'mean_word_length': 2.3630041724617525, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3735300', 'n_tokens_mistral': 621, 'n_tokens_neox': 602, 'n_words': 138}