forked from SoDOff-Project/sodoff
bugfixes
- fix race condition on SetProduct - properly create ModdingService singleton on startup - remove debug print
This commit is contained in:
parent
08b5239880
commit
d8b996c6d7
@ -69,7 +69,7 @@ public class ContentController : Controller {
|
||||
[HttpPost]
|
||||
//[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/SetProduct")] // used by World Of Jumpstart
|
||||
[VikingSession]
|
||||
[VikingSession(UseLock=true)]
|
||||
public bool SetProduct(Viking viking, [FromForm] string contentXml, [FromForm] string apiKey) {
|
||||
Util.SavedData.Set(
|
||||
viking,
|
||||
|
@ -21,7 +21,9 @@ builder.Services.AddControllers(options => {
|
||||
});
|
||||
builder.Services.AddDbContext<DBContext>();
|
||||
|
||||
builder.Services.AddSingleton<ModdingService>();
|
||||
// create Modding Service singleton here ... do this before start http server to avoid serve invalid assets list
|
||||
builder.Services.AddSingleton<ModdingService>(new ModdingService());
|
||||
// other singletons will be created at first use ...
|
||||
builder.Services.AddSingleton<MissionStoreSingleton>();
|
||||
builder.Services.AddSingleton<AchievementStoreSingleton>();
|
||||
builder.Services.AddSingleton<ItemService>();
|
||||
@ -53,10 +55,6 @@ using var scope = app.Services.CreateScope();
|
||||
|
||||
scope.ServiceProvider.GetRequiredService<DBContext>().Database.EnsureCreated();
|
||||
|
||||
// create Modding Service singleton ... do this before start http server to avoid serve invalid assets list
|
||||
|
||||
new ModdingService();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
if (assetServer)
|
||||
|
@ -7,7 +7,6 @@ public class SavedData {
|
||||
}
|
||||
|
||||
public static void Set(Viking viking, uint saveId, string? contentXml) {
|
||||
Console.WriteLine($"\n\n{saveId} {contentXml}\n");
|
||||
Model.SavedData? savedData = viking.SavedData.FirstOrDefault(s => s.SaveId == saveId);
|
||||
if (savedData is null) {
|
||||
savedData = new() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user