// Copyright © 2017-2018 Atomic Software, LLC. All Rights Reserved.
// See LICENSE.md for full license information.

using Atom.Core;
using Atom.Core.Diagnostics;
using Atom.LoginServer.Services;
using System.Linq;

namespace Atom.LoginServer.Engines
{
    public class TransferExpirationEngine : IEngine
    {
        public void Main(long now)
        {
            var ToRemove = (from Transfer in TransferService.GetTransfers() where now - Transfer.Value >= 7000 select Transfer.Key).ToList();

            foreach (var key in ToRemove)
            {
                Log.Info("Removing expired user transfer");
                TransferService.GetTransfers().Remove(key);
            }
        }
    }
}
