在 Google App Engine 开发服务器中组合 --backends 和事务任务队列时出现问题?
我正在将相当大的 App Engine 应用程序上的一些功能移动到后端,突然在通过 dev_appserver.py 运行时使用事务的地方开始出现许多错误:
ApplicationError: ApplicationError: 10001 Transaction(<handle: 0x1, app: "dev~MYAPPNAME", >) not found
我意识到只有当我通过以下方式运行应用程序时才会出现问题 : --后端。我猜测问题的发生是因为我有一个事务使用“transactional=True
”将任务添加到队列中,即:
def txn():
# make model changes
taskqueue.add(url='/models/processupdate', params=my_params, transactional=True, queue_name='not_the_default_q')
db.run_in_transaction(txn)
这是 dev_appserver 的“单线程”性质的结果?有解决办法吗?
I was moving some functionality on a fairly sizeable App Engine application to a backend, and suddenly started getting a number of errors in places where I was using transactions while running via dev_appserver.py:
ApplicationError: ApplicationError: 10001 Transaction(<handle: 0x1, app: "dev~MYAPPNAME", >) not found
I realized the problem only occurs when I run the app via --backends. And I'm guessing the problem is occurring because I have a transaction that adds a task to a queue using "transactional=True
", i.e.:
def txn():
# make model changes
taskqueue.add(url='/models/processupdate', params=my_params, transactional=True, queue_name='not_the_default_q')
db.run_in_transaction(txn)
Is this a result of the 'single threaded' nature of dev_appserver? Is there a work around for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 Google 文档此处,您无法命名队列 如果您的任务是事务性的,则事务性任务只能添加到默认队列!
according to google doc here, you can not name the queue if your task is transactional, the transaction task only can be added to default queue!