Esempio n. 1
0
        public void Run(EventPluginContext context)
        {
            if (String.IsNullOrEmpty(context.Client.Configuration.CurrentSessionIdentifier))
            {
                var user = context.Event.GetUserIdentity(context.Client.Configuration.Resolver.GetJsonSerializer());
                if (user == null || String.IsNullOrEmpty(user.Identity))
                {
                    return;
                }

                context.Client.Configuration.CurrentSessionIdentifier = user.Identity;
            }

            if (_heartbeat == null)
            {
                _heartbeat = new SessionHeartbeat(context.Client.Configuration.CurrentSessionIdentifier, _interval, context.Client);
            }
            else if (_heartbeat.SessionIdentifier != context.Client.Configuration.CurrentSessionIdentifier)
            {
                if (_heartbeat != null)
                {
                    _heartbeat.Dispose();
                }

                _heartbeat = new SessionHeartbeat(context.Client.Configuration.CurrentSessionIdentifier, _interval, context.Client);
            }
            else
            {
                if (_heartbeat != null)
                {
                    _heartbeat.DelayNext();
                }
            }
        }
        public void Run(EventPluginContext context) {
            if (context.Event.IsSessionHeartbeat())
                return;
            
            if (context.Event.IsSessionEnd()) {
                if (_heartbeat != null) {
                    _heartbeat.Dispose();
                    _heartbeat = null;
                }

                return;
            }

            var user = context.Event.GetUserIdentity();
            if (user == null || String.IsNullOrEmpty(user.Identity))
                return;
            
            if (_heartbeat == null) {
                _heartbeat = new SessionHeartbeat(user, context.Client);
            } else if (_heartbeat.User.Identity != user.Identity) {
                if (_heartbeat != null)
                    _heartbeat.Dispose();

                _heartbeat = new SessionHeartbeat(user, context.Client);
            } else {
                if (_heartbeat != null)
                    _heartbeat.DelayNext();
            }
        }
Esempio n. 3
0
 public void Dispose()
 {
     if (_heartbeat != null)
     {
         _heartbeat.Dispose();
         _heartbeat = null;
     }
 }
        public void Run(EventPluginContext context)
        {
            if (context.Event.IsSessionHeartbeat())
            {
                return;
            }

            if (context.Event.IsSessionEnd())
            {
                if (_heartbeat != null)
                {
                    _heartbeat.Dispose();
                    _heartbeat = null;
                }

                return;
            }

            var user = context.Event.GetUserIdentity(context.Client.Configuration.Resolver.GetJsonSerializer());

            if (user == null || String.IsNullOrEmpty(user.Identity))
            {
                return;
            }

            if (_heartbeat == null)
            {
                _heartbeat = new SessionHeartbeat(user, context.Client);
            }
            else if (_heartbeat.User.Identity != user.Identity)
            {
                if (_heartbeat != null)
                {
                    _heartbeat.Dispose();
                }

                _heartbeat = new SessionHeartbeat(user, context.Client);
            }
            else
            {
                if (_heartbeat != null)
                {
                    _heartbeat.DelayNext();
                }
            }
        }
        public void Run(EventPluginContext context) {
            if (String.IsNullOrEmpty(context.Client.Configuration.CurrentSessionIdentifier)) {
                var user = context.Event.GetUserIdentity(context.Client.Configuration.Resolver.GetJsonSerializer());
                if (user == null || String.IsNullOrEmpty(user.Identity))
                    return;

                context.Client.Configuration.CurrentSessionIdentifier = user.Identity;
            }

            if (_heartbeat == null) {
                _heartbeat = new SessionHeartbeat(context.Client.Configuration.CurrentSessionIdentifier, _interval, context.Client);
            } else if (_heartbeat.SessionIdentifier != context.Client.Configuration.CurrentSessionIdentifier) {
                if (_heartbeat != null)
                    _heartbeat.Dispose();

                _heartbeat = new SessionHeartbeat(context.Client.Configuration.CurrentSessionIdentifier, _interval, context.Client);
            } else {
                if (_heartbeat != null)
                    _heartbeat.DelayNext();
            }
        }
 public void Dispose() {
     _heartbeat?.Dispose();
     _heartbeat = null;
 }
 public void Dispose() {
     if (_heartbeat != null) {
         _heartbeat.Dispose();
         _heartbeat = null;
     }
 }