Пример #1
0
            public void Execute()
            {
                try
                {
                    lock (_lock)
                    {
                        if (_shuttingDown)
                        {
                            return;
                        }

                        if (IsBusyImporting)
                        {
                            return;
                        }

                        IsBusyImporting = true;

                        SmsProcessingHelper smsHelper = new SmsProcessingHelper(GlobalHost.ConnectionManager.GetHubContext <ServerSentEventsHub>());
                        smsHelper.Import();

                        IsBusyImporting = false;
                        Debug.WriteLine($"[{DateTime.Now}] Importing finished");
                    }
                }
                finally
                {
                    // Always unregister the job when done.
                    HostingEnvironment.UnregisterObject(this);
                }
            }
Пример #2
0
            public void Execute()
            {
                try
                {
                    lock (_lock)
                    {
                        if (_shuttingDown)
                        {
                            return;
                        }

                        if (IsBusyImporting)
                        {
                            return;
                        }

                        SmsProcessingHelper smsHelper = new SmsProcessingHelper(GlobalHost.ConnectionManager.GetHubContext <ServerSentEventsHub>());
                        smsHelper.Enqueue(BATCHSIZE);
                    }
                }
                finally
                {
                    // Always unregister the job when done.
                    HostingEnvironment.UnregisterObject(this);
                }
            }