dmagda / pg-compute-node

A client-side PostgreSQL extension that lets you execute JavaScript functions on the database directly from the application logic.
Apache License 2.0
24 stars 1 forks source link

Subscribe to logic changes introduced by other app instances #4

Open dmagda opened 10 months ago

dmagda commented 10 months ago

This feature is relevant for the AUTO deployment mode.

It can happen that one application instance cached and uses a version of the logic that the second app instance has just updated. This can lead to errors in runtime.

The deployment component needs to use the LISTEN/NOTIFY feature of Postgres, subscribing to changes in the compute metadata tables. Those tables are updated if any logic changes. In case of any change, an application instance must refresh local compute caches, bringing them to the latest state.