Reputation: 2076
I plan to deploy Parse Server in a Kubernetes cluster with a Horizontal Pod Autoscaler (HPA), which can scale Parse Server to a maximum of 3 instances based on demand.
I have the following Cloud Code implemented, and I need clarification on its behavior when multiple Parse Server instances are running due to scaling:
module.exports = {
initialize: () => {
Parse.Cloud.beforeSave('Post', (request) => {
const post = request.object;
if (!post.get('title')) {
throw new Error('Post must have a title.');
}
post.set('updatedAt', new Date());
});
Parse.Cloud.afterSave('Post', async (request) => {
const post = request.object;
console.log(`Post saved: ${post.get('title')}`);
});
Parse.Cloud.beforeDelete('Post', async (request) => {
const post = request.object;
// Send a one-time notification
});
}
};
Question:
When a Cloud Code trigger such as beforeSave, afterSave, or beforeDelete is executed, will it:
Upvotes: 1
Views: 22