Skip to content

Commit 6b7e78e

Browse files
Merge pull request #69 from nullinside-development-group/feature/duplicates
fix: fixing possible duplicate insertion
2 parents 99382e0 + 21decb5 commit 6b7e78e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Nullinside.Api.TwitchBot/Model/NullinsideContextExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private static async Task<int> UpdateOAuthInDatabase(this INullinsideContext db,
161161
/// <param name="stoppingToken">The stopping token.</param>
162162
public static async Task SaveTwitchBans(this INullinsideContext db, string channelId,
163163
IEnumerable<(string Id, string Username)> bannedUsers, string reason, CancellationToken stoppingToken = new()) {
164-
List<string> banUserIds = bannedUsers.Select(b => b.Id).ToList();
164+
List<string> banUserIds = bannedUsers.Select(b => b.Id).ToHashSet().ToList();
165165
HashSet<string?> existingUsers = db.TwitchUser
166166
.AsNoTracking()
167167
.Where(u => null != u.TwitchId && banUserIds.Contains(u.TwitchId))

0 commit comments

Comments
 (0)