Example #1
0
        public Task Converse(IConversation conversation)
        {
            if (ConversationContext != null)
            {
                throw new InvalidOperationException("Already having a conversation");
            }
            ConversationContext = conversation.Context;

            return(Task
                   .Run(conversation.Start, ConversationContext.TokenSource.Token)
                   .ContinueWith(async t =>
            {
                if (t.IsFaulted)
                {
                    var exception = t.Exception?.Flatten().InnerException;

                    if (!(exception is TaskCanceledException))
                    {
                        Logger.Error(exception, "Caught exception when executing conversation");
                    }
                }

                ConversationContext?.Dispose();
                ConversationContext = null;
                await ModifyStats(exclRequest: true);
            }));
        }
Example #2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
Example #3
0
 public void Dispose()
 {
     _context.Dispose();
 }
Example #4
0
 public async Task Dispose()
 {
     ConversationContext?.Dispose();
     ForcedStat.Reset();
     await Interact(close : true);
 }
Example #5
0
 public void Dispose()
 {
     Db.Dispose();
     GC.SuppressFinalize(this);
 }