Skip to content

Commit

Permalink
Avoid cration of new async contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
seionmoya committed Nov 15, 2024
1 parent 5e1d1f8 commit 292ae02
Show file tree
Hide file tree
Showing 53 changed files with 127 additions and 127 deletions.
4 changes: 2 additions & 2 deletions Fuyu.Backend.Core/Controllers/AccountGamesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public AccountGamesController() : base("/account/games")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var sessionId = context.GetSessionId();
var result = AccountService.GetGames(sessionId);
Expand All @@ -21,7 +21,7 @@ public override async Task RunAsync(HttpContext context)
Games = result
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
4 changes: 2 additions & 2 deletions Fuyu.Backend.Core/Controllers/AccountLogoutController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ public AccountLogoutController() : base("/account/logout")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var sessionId = context.GetSessionId();
CoreOrm.RemoveSession(sessionId);

await context.SendJsonAsync("{}");
return context.SendJsonAsync("{}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public AccountCustomizationController() : base("/client/account/customization")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
await context.SendJsonAsync(EftOrm.GetAccountCustomization());
return context.SendJsonAsync(EftOrm.GetAccountCustomization());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public AchievementListController() : base("/client/achievement/list")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
await context.SendJsonAsync(EftOrm.GetAchievementList());
return context.SendJsonAsync(EftOrm.GetAchievementList());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ public AchievementStatisticController() : base("/client/achievement/statistic")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var json = EftOrm.GetAchievementStatistic();
var response = Json.Parse<ResponseBody<AchievementStatisticResponse>>(json);
await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
4 changes: 2 additions & 2 deletions Fuyu.Backend.EFT/Controllers/Http/BuildsListController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public BuildsListController() : base("/client/builds/list")
_response = Json.Parse<ResponseBody<BuildsListResponse>>(json);
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
await context.SendJsonAsync(Json.Stringify(_response));
return context.SendJsonAsync(Json.Stringify(_response));
}
}
}
4 changes: 2 additions & 2 deletions Fuyu.Backend.EFT/Controllers/Http/CheckVersionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public CheckVersionController() : base("/client/checkVersion")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var response = new ResponseBody<CheckVersionResponse>()
{
Expand All @@ -22,7 +22,7 @@ public override async Task RunAsync(HttpContext context)
}
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
4 changes: 2 additions & 2 deletions Fuyu.Backend.EFT/Controllers/Http/CustomizationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public CustomizationController() : base("/client/customization")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var customizations = EftOrm.GetCustomizations();
var response = new ResponseBody<Dictionary<string, CustomizationTemplate>>()
{
data = customizations
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public CustomizationStorageController() : base("/client/trading/customization/st
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var sessionId = context.GetSessionId();
var profile = EftOrm.GetActiveProfile(sessionId);
Expand All @@ -25,7 +25,7 @@ public override async Task RunAsync(HttpContext context)
}
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
4 changes: 2 additions & 2 deletions Fuyu.Backend.EFT/Controllers/Http/FriendListController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public FriendListController() : base("/client/friend/list")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var response = new ResponseBody<FriendListResponse>()
{
Expand All @@ -23,7 +23,7 @@ public override async Task RunAsync(HttpContext context)
}
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public FriendRequestListInboxController() : base("/client/friend/request/list/in
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var response = new ResponseBody<object[]>()
{
data = []
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public FriendRequestListOutboxController() : base("/client/friend/request/list/o
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var response = new ResponseBody<object[]>()
{
data = []
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
4 changes: 2 additions & 2 deletions Fuyu.Backend.EFT/Controllers/Http/GameConfigController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public GameConfigController() : base("/client/game/config")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var response = new ResponseBody<GameConfigResponse>
{
Expand All @@ -37,7 +37,7 @@ public override async Task RunAsync(HttpContext context)
}
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
4 changes: 2 additions & 2 deletions Fuyu.Backend.EFT/Controllers/Http/GameKeepaliveController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public GameKeepaliveController() : base("/client/game/keepalive")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var response = new ResponseBody<GameKeepaliveResponse>
{
Expand All @@ -22,7 +22,7 @@ public override async Task RunAsync(HttpContext context)
}
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
4 changes: 2 additions & 2 deletions Fuyu.Backend.EFT/Controllers/Http/GameLogoutController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public GameLogoutController() : base("/client/game/logout")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var response = new ResponseBody<GameLogoutResponse>()
{
Expand All @@ -21,7 +21,7 @@ public override async Task RunAsync(HttpContext context)
}
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public GameProfileListController() : base("/client/game/profile/list")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var sessionId = context.GetSessionId();
var profile = EftOrm.GetActiveProfile(sessionId);
Expand All @@ -32,7 +32,7 @@ public override async Task RunAsync(HttpContext context)
data = profiles
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public GameProfileNicknameReservedController() : base("/client/game/profile/nick
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var sessionId = context.GetSessionId();
var account = EftOrm.GetAccount(sessionId);
Expand All @@ -21,7 +21,7 @@ public override async Task RunAsync(HttpContext context)
data = account.Username
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public GameProfileSelectController() : base("/client/game/profile/select")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var response = new ResponseBody<ProfileSelectResponse>()
{
Expand All @@ -21,7 +21,7 @@ public override async Task RunAsync(HttpContext context)
}
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
4 changes: 2 additions & 2 deletions Fuyu.Backend.EFT/Controllers/Http/GameStartController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public GameStartController() : base("/client/game/start")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var response = new ResponseBody<GameStartResponse>()
{
Expand All @@ -21,7 +21,7 @@ public override async Task RunAsync(HttpContext context)
}
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public GameVersionValidateController() : base("/client/game/version/validate")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var response = new ResponseBody<object>()
{
data = null
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public GetMetricsConfigController() : base("/client/getMetricsConfig")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
var response = new ResponseBody<GetMetricsConfigResponse>()
{
Expand All @@ -26,7 +26,7 @@ public override async Task RunAsync(HttpContext context)
}
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
4 changes: 2 additions & 2 deletions Fuyu.Backend.EFT/Controllers/Http/GlobalsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public GlobalsController() : base("/client/globals")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
await context.SendJsonAsync(EftOrm.GetGlobals());
return context.SendJsonAsync(EftOrm.GetGlobals());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public HandbookTemplatesController() : base("/client/handbook/templates")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context)
{
await context.SendJsonAsync(EftOrm.GetHandbook());
return context.SendJsonAsync(EftOrm.GetHandbook());
}
}
}
Loading

0 comments on commit 292ae02

Please sign in to comment.