Fix StatisticsHelper concurrent exception

This commit is contained in:
Slendy 2022-09-05 05:04:06 -05:00
parent cf5369d372
commit eb7cda8997
No known key found for this signature in database
GPG key ID: 7288D68361B91428
9 changed files with 65 additions and 44 deletions

View file

@ -182,7 +182,7 @@ public class SlotsController : ControllerBase
string response = Enumerable.Aggregate(slots, string.Empty, (current, slot) => current + slot.Serialize(gameVersion));
int start = pageStart + Math.Min(pageSize, ServerConfiguration.Instance.UserGeneratedContentLimits.EntitledSlots);
int total = await StatisticsHelper.SlotCount();
int total = await StatisticsHelper.SlotCountForGame(this.database, token.GameVersion);
return this.Ok(generateSlotsResponse(response, start, total));
}
@ -238,9 +238,9 @@ public class SlotsController : ControllerBase
.Skip(Math.Max(0, pageStart - 1))
.Take(Math.Min(pageSize, 30));
string response = Enumerable.Aggregate(slots, string.Empty, (current, slot) => current + slot.Serialize(gameVersion));
string response = slots.Aggregate(string.Empty, (current, slot) => current + slot.Serialize(gameVersion));
int start = pageStart + Math.Min(pageSize, ServerConfiguration.Instance.UserGeneratedContentLimits.EntitledSlots);
int total = await StatisticsHelper.SlotCount();
int total = await StatisticsHelper.SlotCount(this.database);
return this.Ok(generateSlotsResponse(response, start, total));
}
@ -290,7 +290,7 @@ public class SlotsController : ControllerBase
.Take(Math.Min(pageSize, 30));
string response = Enumerable.Aggregate(slots, string.Empty, (current, slot) => current + slot.Serialize(gameVersion));
int start = pageStart + Math.Min(pageSize, ServerConfiguration.Instance.UserGeneratedContentLimits.EntitledSlots);
int total = await StatisticsHelper.TeamPickCount();
int total = await StatisticsHelper.TeamPickCount(this.database);
return this.Ok(generateSlotsResponse(response, start, total));
}
@ -309,7 +309,7 @@ public class SlotsController : ControllerBase
string response = slots.Aggregate(string.Empty, (current, slot) => current + slot.Serialize(gameVersion));
int start = pageStart + Math.Min(pageSize, ServerConfiguration.Instance.UserGeneratedContentLimits.EntitledSlots);
int total = await StatisticsHelper.SlotCount();
int total = await StatisticsHelper.SlotCountForGame(this.database, token.GameVersion);
return this.Ok(generateSlotsResponse(response, start, total));
}
@ -341,7 +341,7 @@ public class SlotsController : ControllerBase
string response = slots.Aggregate(string.Empty, (current, slot) => current + slot.Serialize(token.GameVersion));
int start = pageStart + Math.Min(pageSize, ServerConfiguration.Instance.UserGeneratedContentLimits.EntitledSlots);
int total = await StatisticsHelper.SlotCount();
int total = await StatisticsHelper.SlotCountForGame(this.database, token.GameVersion);
return this.Ok(generateSlotsResponse(response, start, total));
}
@ -387,7 +387,7 @@ public class SlotsController : ControllerBase
string response = slots.Aggregate(string.Empty, (current, slot) => current + slot.Serialize(token.GameVersion));
int start = pageStart + Math.Min(pageSize, ServerConfiguration.Instance.UserGeneratedContentLimits.EntitledSlots);
int total = await StatisticsHelper.SlotCount();
int total = await StatisticsHelper.SlotCountForGame(this.database, token.GameVersion);
return this.Ok(generateSlotsResponse(response, start, total));
}
@ -419,7 +419,7 @@ public class SlotsController : ControllerBase
string response = slots.Aggregate(string.Empty, (current, slot) => current + slot.Serialize(token.GameVersion));
int start = pageStart + Math.Min(pageSize, ServerConfiguration.Instance.UserGeneratedContentLimits.EntitledSlots);
int total = await StatisticsHelper.SlotCount();
int total = await StatisticsHelper.SlotCountForGame(this.database, token.GameVersion);
return this.Ok(generateSlotsResponse(response, start, total));
}