Closed avriltank closed 2 years ago
thanks for the question.
What is the exception, and what is not working?
To call the sharpLib.Queue.send() from PHP, it would look like:
sharpLib\Queue::send( fn () => echo 123 );
Please note, the "Context" ctx
lives only during the request.
There is no exception.when i push job to the background queue,the request will wati for a long time until the timeout of peachpie
I think we would need more information. This needs to be debugged; where is it waiting, is there anything in Output window, is there a lock? etc.
the "Context" ctx lives only during the request.But I just wrap in to an Action for a timer or queue,the timer works well,but the queue is dead.
//context code is dead
var theContext = Context.CreateEmpty();
Console.WriteLine(theContext.ToString());//result:Pchp.Core.Context
return BackgroundJob.Schedule(() => Console.WriteLine(theContext),TimeSpan.FromMilliseconds(3000));//there is no result after 3000ms
//work fine code
var theContext = "testStr";
return BackgroundJob.Schedule(() => Console.WriteLine(theContext),TimeSpan.FromMilliseconds(3000));//console will echo 'testStr' after 3000ms
It seems that: the hangfire job queue can't work with the Pchp.Core.Context object
1/ the Context is IDisposable - you should always dispose the object 2/ what does it mean "does not work" ? You have to debug it to see what's happening
1,yes,I just test how it works,so I create a new context 2,if it works fine,the console window will echo theContext after 3000ms with the delay job.
you have to do some debugging;
Therefore, the body of the lambda expression () => theFunc.Invoke(ctx, theParams) ends up being a InvocationExpression, not a MethodCallExpression for hangfire!So there is no result.
Thanks for your reply,@jakubmisek
Hi,@jakubmisek,can I get some help?why hangfire job can not be invoked?I don't konw how to deal this probelm in csharp code.
Csharp code:
Php code:
This is the sample code. one_web.zip