Compare commits

...
3 Commits
Author SHA1 Message Date
FlorianDahn 8e29652148 Fixing possible Deadlock in AutoCleanForm 2021-10-17 15:39:31 +02:00
Florian Dahn 5bb316d874 Merge pull request #15 from victorrar/f/update-readme
Fix documentation inaccuracy

Thanks !
2021-10-04 21:35:59 +02:00
Victor d2ae08771e Fix documentation inaccuracy 2021-10-04 21:55:41 +03:00
2 changed files with 23 additions and 11 deletions
+2 -4
View File
@@ -169,11 +169,9 @@ public class StartForm : FormBase
} }
//Gets invoked during Navigation to this form //Gets invoked during Navigation to this form
public override async Task Init(params object[] param)
{
} //Init() got replaced with event handler
//Opened() got replaced with event handler //Opened() got replaced with event handler
+19 -5
View File
@@ -150,8 +150,15 @@ namespace TelegramBotBase.Form
{ {
parallelQuery.ForAll(i => parallelQuery.ForAll(i =>
{ {
Device.DeleteMessage(i).GetAwaiter().GetResult(); try
deletedMessages.Add(i); {
Device.DeleteMessage(i).GetAwaiter().GetResult();
deletedMessages.Add(i);
}
catch (ApiRequestException req) when (req.ErrorCode == 400)
{
deletedMessages.Add(i);
}
}); });
} }
catch (AggregateException ex) catch (AggregateException ex)
@@ -160,7 +167,7 @@ namespace TelegramBotBase.Form
var retryAfterSeconds = ex.InnerExceptions var retryAfterSeconds = ex.InnerExceptions
.Where(e => e is ApiRequestException apiEx && apiEx.ErrorCode == 429) .Where(e => e is ApiRequestException apiEx && apiEx.ErrorCode == 429)
.Max(e =>(int?) ((ApiRequestException)e).Parameters.RetryAfter) ?? 0; .Max(e => (int?)((ApiRequestException)e).Parameters.RetryAfter) ?? 0;
retryAfterTask = Task.Delay(retryAfterSeconds * 1000); retryAfterTask = Task.Delay(retryAfterSeconds * 1000);
} }
@@ -183,8 +190,15 @@ namespace TelegramBotBase.Form
{ {
parallelQuery.ForAll(i => parallelQuery.ForAll(i =>
{ {
Device.DeleteMessage(i).GetAwaiter().GetResult(); try
deletedMessages.Add(i); {
Device.DeleteMessage(i).GetAwaiter().GetResult();
deletedMessages.Add(i);
}
catch (ApiRequestException req) when (req.ErrorCode == 400)
{
deletedMessages.Add(i);
}
}); });
} }
catch (AggregateException ex) catch (AggregateException ex)