1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 05:15:43 +00:00

ConfigureAwait(true) on awaited methods

This commit is contained in:
Oliver Booth 2022-11-29 16:11:06 +00:00
parent 020b06334b
commit c9e473e86f
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
7 changed files with 16 additions and 16 deletions

View File

@ -75,6 +75,6 @@ public static class DiscordChannelExtensions
} }
#endif #endif
return await client.GetChannelAsync(channel.Id); return await client.GetChannelAsync(channel.Id).ConfigureAwait(true);
} }
} }

View File

@ -24,7 +24,7 @@ public static class DiscordGuildExtensions
} }
#endif #endif
await Task.WhenAll(guild.Threads.Values.Select(t => t.JoinThreadAsync())); await Task.WhenAll(guild.Threads.Values.Select(t => t.JoinThreadAsync())).ConfigureAwait(true);
} }
/// <summary> /// <summary>
@ -58,6 +58,6 @@ public static class DiscordGuildExtensions
} }
#endif #endif
return await client.GetGuildAsync(guild.Id); return await client.GetGuildAsync(guild.Id).ConfigureAwait(true);
} }
} }

View File

@ -67,7 +67,7 @@ public static class DiscordMemberExtensions
} }
#endif #endif
DiscordGuild guild = await member.Guild.NormalizeClientAsync(client); DiscordGuild guild = await member.Guild.NormalizeClientAsync(client).ConfigureAwait(true);
return await guild.GetMemberAsync(member.Id); return await guild.GetMemberAsync(member.Id).ConfigureAwait(true);
} }
} }

View File

@ -26,8 +26,8 @@ public static class DiscordMessageExtensions
} }
#endif #endif
await Task.Delay(delay); await Task.Delay(delay).ConfigureAwait(true);
await message.DeleteAsync(reason); await message.DeleteAsync(reason).ConfigureAwait(true);
} }
/// <summary> /// <summary>
@ -48,8 +48,8 @@ public static class DiscordMessageExtensions
} }
#endif #endif
DiscordMessage message = await task; DiscordMessage message = await task.ConfigureAwait(true);
await message.DeleteAfterAsync(delay, reason); await message.DeleteAfterAsync(delay, reason).ConfigureAwait(true);
} }
/// <summary> /// <summary>
@ -83,7 +83,7 @@ public static class DiscordMessageExtensions
} }
#endif #endif
DiscordChannel channel = await message.Channel.NormalizeClientAsync(client); DiscordChannel channel = await message.Channel.NormalizeClientAsync(client).ConfigureAwait(true);
return await channel.GetMessageAsync(message.Id); return await channel.GetMessageAsync(message.Id).ConfigureAwait(true);
} }
} }

View File

@ -52,7 +52,7 @@ public static class DiscordUserExtensions
try try
{ {
return await guild.GetMemberAsync(user.Id); return await guild.GetMemberAsync(user.Id).ConfigureAwait(true);
} }
catch (NotFoundException) catch (NotFoundException)
{ {
@ -113,7 +113,7 @@ public static class DiscordUserExtensions
try try
{ {
DiscordMember? member = await guild.GetMemberAsync(user.Id); DiscordMember? member = await guild.GetMemberAsync(user.Id).ConfigureAwait(true);
return member is not null; return member is not null;
} }
catch (NotFoundException) catch (NotFoundException)
@ -153,6 +153,6 @@ public static class DiscordUserExtensions
} }
#endif #endif
return await client.GetUserAsync(user.Id); return await client.GetUserAsync(user.Id).ConfigureAwait(true);
} }
} }

View File

@ -69,7 +69,7 @@ public static class CollectionExtensions
continue; continue;
} }
await item.DisposeAsync(); await item.DisposeAsync().ConfigureAwait(true);
} }
source.Clear(); source.Clear();

View File

@ -226,7 +226,7 @@ public static class EnumerableExtensions
continue; continue;
} }
await item.DisposeAsync(); await item.DisposeAsync().ConfigureAwait(true);
} }
} }