This repository has been archived by the owner on Dec 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 84
Plugin HTTP handler or Lambda not getting called, after triggering after_save with async=True #347
Labels
Comments
plugin: import logging
import skygear
log = logging.getLogger(__name__)
@skygear.handler('handler', method=['POST'])
def handler(req):
return {
'result': 'handler is OK'
}
@skygear.after_save('recordA', async=True)
def recordA_async_after_save(record, original_record, conn):
log.info('recordA_async_after_save') client.js const skygear = require('skygear');
const agent = require('superagent');
const RecordA = skygear.Record.extend('recordA');
skygear.config({
'apiKey': 'apikey',
'endPoint': 'http://localhost:3000/',
}).then(() => {
return skygear.signupAnonymously();
}).then(() => {
const r = new RecordA({ 'content': 'Hello World' });
return skygear.publicDB.save(r, {atomic: true});
}).then(() => {
console.log('save success');
agent.post('http://localhost:3000/handler').end((err, res) => {
if (err) {
console.log('http handler err');
} else {
console.log('http handler success');
}
});
}).catch(() => {
console.log('save failed');
}); log: save success
## after a while
http handler err |
Cause identified. ZMQ broker expect the response channel to be consumed. When a request is ended before async handler responds, transport gives up consuming from broker. Broker keeps waiting for the channel to be consumed. Working on a fix. |
@Steven-Chan Can you help verify the pull request fixed your issue? If yes please close it. |
Steven verified it is fixed. |
2 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Skygear Server Date/Version: v0.22.1, python plugin with zmq
Steps to reproduce
Methods to make the handler work:
either:
The text was updated successfully, but these errors were encountered: