コード例 #1
0
ファイル: RediScraper.cs プロジェクト: TzarIvan/ratel
        public void DisconnectPositionListener()
        {
            try {
                lock (lockObject) {
                    if (!IsPositionListenerStarted)
                    {
                        return;
                    }

                    foreach (var account in watchedAccounts)
                    {
                        object watchErrorCode = null;
                        var    watchResult    = positionCacheControl.DeleteWatch(2, "", account, ref watchErrorCode);
                        log.Info("Removed watch on account: " + account + ", result=" + watchResult);
                    }

                    watchedAccounts.Clear();

                    object errorCode     = null;
                    var    revokedResult = positionCacheControl.Revoke(ref errorCode);
                    IsPositionListenerStarted = false;
                    log.Info("Disconnect Position result: " + revokedResult + ", ErrorCode: " + errorCode);
                }
            } catch (Exception e) {
                // it might not make sense to set this to true
                IsPositionListenerStarted = true;
                log.Error("Failed to disconnect position listener to Redi", e);
            }
        }
コード例 #2
0
ファイル: RediScraper.cs プロジェクト: TzarIvan/ratel
 public void DisconnectMessageListener()
 {
     lock (lockObject) {
         if (!IsMessageListenerStarted)
         {
             return;
         }
     }
     try {
         object errorCode     = null;
         var    revokedResult = messageCacheControl.Revoke(ref errorCode);
         IsMessageListenerStarted = false;
         log.Info("Disconnect Message result: " + revokedResult + ", ErrorCode: " + errorCode);
     } catch (Exception e) {
         // it might not make sense to set this to true
         IsMessageListenerStarted = true;
         log.Error("Failed to disconnect message listener to Redi", e);
     }
 }