BulkAction with polling within action closure
I have a BulkAction that generates a PDF file and force downloads it. The problem is that the generation takes too long (60s+) and the server times out.
My idea is in the BulkAction action() closure to dispatch the job that generates that file and uploads it. It will keep the state of the job in DB so I need to periodically check if it's generated & store and when it is, to force-download it.
I read about polling in Livewire and got that
<div wire:poll="foo">
which I thought to render within this closure, it should call the "foo" action, which action should check the DB if the file is uploaded and will force-download it.
The think in the last paragraph did not worked though as the "foo" action is not being executed. Do you have any ideas why is that, or other ideas of how to solve my problem?1 Reply
hey @StanProg have you found a solution? You might add the
->extraAttributes()
method to your action with a callback returning conditionally ['wire:poll' => '']
This is what I use but if you found another way to deal with it I will be happy to hear it!