api-platform / core

The server component of API Platform: hypermedia and GraphQL APIs in minutes
https://api-platform.com
MIT License
2.39k stars 848 forks source link

[Mercure][Feature] Configure automatic mercure updates #3785

Open stephanvierkant opened 3 years ago

stephanvierkant commented 3 years ago

As far as I can see, API Platform sends updates on insert/update/delete (\ApiPlatform\Core\Bridge\Doctrine\EventListener\PublishMercureUpdatesListener::onFlush) automatically. This causes performance problems if many entities are updated/inserted/deleted at once. In my case, I'm not listening to inserts and deletions, so it doesn't make sense to send the updates in the first place.

It would be great if some kind of configuration would be possible.

soyuka commented 3 years ago

This is true only with mercure=true on an entity right? I'd say that you should definitely override our PublishMercureUpdatesListener to have all the control you need. I've done so on few projects already. I'm having a hard time seeing how we could "configure" these updates unless coding the listener.