skip to Main Content

Should I use async with the ASP.NET QueueBackgroundWorkItem method for an async method?

When using QueueBackgroundWorkItem, is there any difference in the below two ways of calling a method that performs async operations like api calls? HostingEnvironment.QueueBackgroundWorkItem(async cancellationToken => { var result = await LongRunningMethodAsync(); }); Or the following: HostingEnvironment.QueueBackgroundWorkItem(cancellationToken => LongRunningMethodAsync()); I'm…

VIEW QUESTION

How does NextJS execute the code inside these functions with and without async? – Javascript

Function with async: export async function getPostData(id) { const fullPath = path.join(postsDirectory, `${id}.md`); const fileContents = fs.readFileSync(fullPath, 'utf8'); const matterResult = matter(fileContents); return { id, ...matterResult.data, }; } Function without async: export function getPostData(id) { const fullPath = path.join(postsDirectory, `${id}.md`);…

VIEW QUESTION
Back To Top
Search