Exemplo n.º 1
0
        public bool ShouldUpdate(bool force, DateTime updateIfOlderThan, ApiType apiType, long?refId)
        {
            if (force)
            {
                _runnerRepository.StartUpdate(apiType, refId);
                return(true);
            }

            // there is no point in updating the y every few seconds so lets see when last update was
            var lastrun = GetLastRun(apiType, refId);

            // if last update is in the last x hours don't get new y as it is unlikely there is new
            if (lastrun == null || Convert.ToDateTime(lastrun) <= updateIfOlderThan)
            {
                _runnerRepository.StartUpdate(apiType, refId);
                return(true);
            }
            return(false);
        }