You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A mentioned in the docs, both ctx.forward() and ctx.invoke() result in the underlying function being called, which in pygeoapi's case means the call to serve_flask will run twice.
This can be seen if you run the pygeoapi server with pygeoapi serve and then try to stop it by pressing <CTRL+C> - You will need to press this key combination twice, as the first time it stops the first invocation (i.e. the call to ctx.forward() and proceeds to run pygeoapi server again, as it reaches the second invocation (i.e. the call to ctx.invoke()).
export PYGEOAPI_CONFIG=my-config.yml
export PYGEOAPI_OPENAPI=my-openapi.yml
pygeoapi serve
# in order to exit you need to press CTRL+C twice
The text was updated successfully, but these errors were encountered:
@ricardogsilva Yes, this is a really annoying, because if we want to attach a debugger to the pygeoapi process, we are never sure which one to choose. It is also draining resources. Do you have any suggestions on how to fix this?
The fix would simply be to remove one of the calls, either ctx.forward() or ctx.invoke() - I haven't reviewed it in depth to see which one should be preferred.
However, I believe this would not be the reason for troubles when attaching a debugger, as each pygeoapi invocation is done in sequence, meaning the second one only starts running when one decides to press CTRL+C, which ends the first one and then starts the second
Description
The
pygeoapi serve
command invokes the web application twice, as can be seen here:pygeoapi/pygeoapi/__init__.py
Lines 99 to 100 in e1fe05c
According to the click docs,
context.forward()
andcontext.invoke()
are somewhat similar:A mentioned in the docs, both
ctx.forward()
andctx.invoke()
result in the underlying function being called, which in pygeoapi's case means the call toserve_flask
will run twice.This can be seen if you run the pygeoapi server with
pygeoapi serve
and then try to stop it by pressing<CTRL+C>
- You will need to press this key combination twice, as the first time it stops the first invocation (i.e. the call toctx.forward()
and proceeds to run pygeoapi server again, as it reaches the second invocation (i.e. the call toctx.invoke()
).The text was updated successfully, but these errors were encountered: