예제 #1
0
        public long Feed(WatchdogFood <TFoodType, TData> food)
        {
            if (_logger.IsEnabled(LogLevel.Trace))
            {
                _logger.LogTrace($"<{Name}> feed({JsonConvert.SerializeObject(food)})");
            }

            if (food.Timeout <= 0)
            {
                food.Timeout = DefaultTimeout;
            }

            var left = Left();

            StopTimer();
            StartTimer(food.Timeout);

            _lastFeed = DateTime.Now.GetUnixEpochMillisecond();
            _lastFood = food;

            _ = Emit("feed", food, left);

            return(left);
        }
예제 #2
0
 private void DogReset(WatchdogFood <object, EventHeartbeatPayload> lastFood, long time) => Emit(lastFood.Data);