protected override void RunCallback()
        {
            var dbFactory = new DbFactory();
            var time      = new TimeService(dbFactory);

            var settings = new SettingsService(dbFactory);

            var lastSyncDate = settings.GetListingsPriceSyncDate(_api.Market, _api.MarketplaceId);

            LogWrite("Last sync date=" + lastSyncDate + ", _betweenProcessingInverval=" + _betweenProcessingInverval);

            if (!lastSyncDate.HasValue ||
                (time.GetUtcTime() - lastSyncDate) > _betweenProcessingInverval)
            {
                var feed = new WalmartPriceFeed(GetLogger(), time, _api, dbFactory,
                                                AppSettings.WalmartFeedBaseDirectory);

                var feedDto = feed.CheckFeedStatus(TimeSpan.FromHours(1));

                if (feedDto == null) //NOTE: no feed to check
                {
                    feed.SubmitFeed();
                }

                settings.SetListingsPriceSyncDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId);
            }
        }
Esempio n. 2
0
        public void SubmitPriceFeed(WalmartApi api, IList <string> skuList)
        {
            var feed = new WalmartPriceFeed(_log, _time, api, _dbFactory,
                                            AppSettings.WalmartFeedBaseDirectory);

            var feedDto = feed.CheckFeedStatus(TimeSpan.Zero);

            if (feedDto == null) //NOTE: no feed to check
            {
                feed.SubmitFeed(skuList);
            }
        }