Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TaskQueue.Enqueue(Expression<Func<T>>) to suppress warning CS4014 #55

Open
ArcticLampyrid opened this issue Mar 3, 2021 · 2 comments

Comments

@ArcticLampyrid
Copy link

public static TaskInfo ToTaskInfo<T>(this Expression<Func<T>> expression)

Since ToTaskInfo(this Expression<Func<T>>) is available, why not add TaskQueue.Enqueue(Expression<Func<T>>)?
It's helpful to suppress warning CS4014 with async function.

CS4014: Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the await operator to the result of the call.

At least TaskQueue.Enqueue(Expression<Func<Task>>) should be added.

@brthor
Copy link
Owner

brthor commented Mar 4, 2021

The intention is to eventually allow job return values to be fetched which is likely why TaskQueue.Enqueue(Expression<Func<T>>) was placed there.

(16f8708)

As for the Compiler Warnings, there is a special extension method you can use to bypass them:
https://github.com/brthor/Gofer.NET/blob/master/Gofer.NET.Utils/TaskExtensions.cs#L12

An example of this here:
https://github.com/brthor/Gofer.NET/blob/master/Gofer.NET.Tests/GivenARedisTaskQueue.cs#L99

EDIT:
For reference, the requested functionality was removed here: 510cf3a#diff-2afb79e64d5ed88321d16c16d382ced69fbad41f713483e48b3a80cbadd1b881

@ArcticLampyrid
Copy link
Author

Though Expression<Func<T>> can be confusing and may be mistaken for the support for result-fetchable job, Expression<Func<Task>> can still be a acceptable choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants