# |
Jul 19th 2021, 19:37 |
sebastiansperandio093 |
I will check it! |
# |
Jul 19th 2021, 19:37 |
sebastiansperandio093 |
ohh I saw it before! thanks! |
# |
Jul 19th 2021, 19:34 |
kevin.pfeifer |
I think you would definitely benefit from a queue system where you add your internal “process the payment updates” to an async background job while your main response delivers your 200. I would recommend https://github.com/dereuromark/cakephp-queue :P |
# |
Jul 19th 2021, 19:30 |
dereuromark |
those sound like 2 different requests, which at least one of them is a async (queue background) task. |
# |
Jul 19th 2021, 19:30 |
alamnaryab |
@greg138 :+1: |
# |
Jul 19th 2021, 19:29 |
slackebot2 |
do your job (for example, update your db with the payment updates) |
# |
Jul 19th 2021, 19:29 |
sebastiansperandio093 |
@kevin.pfeifer not exactly....they are just notifying me when a payment status is updated. So they asking me a notification URL to send 2 parameters....i.e: https://www.domain.com?topics=paymentsandid=123456 they have a retry process for these notifications. If you dont response 200 after 22 seconds (I know it is toooo time), they have a retry schedule. This is why they recommend that you respond 200 first and then |
# |
Jul 19th 2021, 19:23 |
greg138 |
Then, `->contain(['StudentTransports.RouteStops.TransportRoutes'])` would give you what you're looking for? |
# |
Jul 19th 2021, 19:22 |
alamnaryab |
yes |
# |
Jul 19th 2021, 19:22 |
greg138 |
@alamnaryab, your RouteStops table is associated with both StudentTransports and TransportRoutes? |
# |
Jul 19th 2021, 19:20 |
kevin.pfeifer |
@sebastiansperandio093 so your API requires a 200 (or 201) response as a “yea, got it, I’m working on it” and at a later point another 200 after its done? You can’t send 2 responses to 1 request, how should that work? I think you misunderstand the API documentation. |
# |
Jul 19th 2021, 19:14 |
sebastiansperandio093 |
you could use "use" |
# |
Jul 19th 2021, 19:12 |
slackebot2 |
StudentTransports.route_stop_id here //bcz without condition it is showing all records of RouteStops return $q->where(['RouteStops.id'=> /*????**/]); } ] )->first();``` or any other better way to get multi level nested contained queries |
# |
Jul 19th 2021, 19:12 |
alamnaryab |
Hi is it possible to access proprty of parent Model in contained model ```$student = $this->Students->find() ->where(['Students.id' => $id]) ->contain( [ 'StudentTransports', 'StudentTransports.TransportRoutes', 'StudentTransports.TransportRoutes.RouteStops'=>function($q){ //can I access |
# |
Jul 19th 2021, 19:10 |
sebastiansperandio093 |
I could omit this recommendations as a B plan |
# |
Jul 19th 2021, 19:09 |
sebastiansperandio093 |
is an payment gateway API, and it is sending notifications about pending payments and it expects a 200 status code. |
# |
Jul 19th 2021, 19:08 |
sebastiansperandio093 |
yes I totally agree about it is a bad design, but API documentation recommends send a response before working. |
# |
Jul 19th 2021, 19:04 |
dereuromark |
you can (and should) return the response instead. And then maybe a afterFilter callback or middleware could still be applied. not sure. but either way, this sounds like a bad design. |
# |
Jul 19th 2021, 18:58 |
kevin.pfeifer |
well what is the reason that it should actually happen after the response and not before? |
# |
Jul 19th 2021, 18:55 |
sebastiansperandio093 |
response code should be 200 or 201 |
# |
Jul 19th 2021, 18:55 |
sebastiansperandio093 |
it doesnt work |
# |
Jul 19th 2021, 18:55 |
sebastiansperandio093 |
```$this->response = $this->response->withStatus(201); $this->response->send(); echo 'hello';exit;``` |
# |
Jul 19th 2021, 18:54 |
sebastiansperandio093 |
hello everyone, can I send a response 200 and continue processing php after sending it? |
# |
Jul 19th 2021, 17:13 |
admad |
"Task failed successfully" |
# |
Jul 19th 2021, 17:10 |
tyler.adam.lazenby |
I had just migrated from using users to reference contacts to accounts |
# |
Jul 19th 2021, 17:10 |
tyler.adam.lazenby |
i found the issue |
# |
Jul 19th 2021, 17:10 |
kevin.pfeifer |
because according to https://github.com/dereuromark/cakephp-queue/blob/c7f0386218387d7fd9dba2781449fcfbb984e59d/src/Queue/Processor.php#L206 you get that message in the worker if any exception is being thrown inside your task |
# |
Jul 19th 2021, 17:10 |
tyler.adam.lazenby |
Gawwww |
# |
Jul 19th 2021, 17:09 |
tyler.adam.lazenby |
I am importing data from a csv file into my database to create or update contacts |
# |
Jul 19th 2021, 17:08 |
kevin.pfeifer |
can you maybe provide the content of your task you try to run with the worker? |
# |
Jul 19th 2021, 17:04 |
tyler.adam.lazenby |
yes |
# |
Jul 19th 2021, 17:03 |
kevin.pfeifer |
so your task can successfully be added to the queue but when the worker tries to process it you get "task did not finish" ? |
# |
Jul 19th 2021, 17:02 |
tyler.adam.lazenby |
job did not finish |
# |
Jul 19th 2021, 17:01 |
tyler.adam.lazenby |
looking into that |
# |
Jul 19th 2021, 17:01 |
tyler.adam.lazenby |
now I am just getting "task did not finish" |
# |
Jul 19th 2021, 17:01 |
tyler.adam.lazenby |
No |
# |
Jul 19th 2021, 16:57 |
kevin.pfeifer |
did that fix your problem? |
# |
Jul 19th 2021, 16:46 |
tyler.adam.lazenby |
thank you |
# |
Jul 19th 2021, 16:43 |
tyler.adam.lazenby |
I will now |
# |
Jul 19th 2021, 16:42 |
kevin.pfeifer |
have you read https://github.com/dereuromark/cakephp-queue/tree/master/docs#coming-from-v5-to-v6 ? |
# |
Jul 19th 2021, 16:41 |
tyler.adam.lazenby |
help |