ajax - Is this C# await superfluous? -
i understand threading extent, in practice have little experience. in looking @ code maintaining, seems await provides no benefit. calls method via ajax , happen when user clicks export link. since method nothing else, don't see advantage await , instead imagine introduces overhead. believe other users clicking export entering method own thread, right? might useful if single user clicked export many times, quickly? thank you.
[preventlogging] [httppost] public async task<jsonresult> getactivityreportcallsasync([datasourcerequest] datasourcerequest request) { try { var result = await getallcallsasync(); return json(result.todatasourceresult(request)); } catch (exception exc) { return jsonshowmessage(false, servermessagetype.error, exc.message); } }
it seems await provides no benefit
you may want take @ async
on asp.net msdn article. in it, enumerate number of common misconceptions async
or won't requests.
in summary, async
/await
on asp.net scalability, , assumes already have scalable backend. won't make individual request run faster, or return earlier, or that.
Comments
Post a Comment