rorodata / firefly

function as a service
http://rorodata.github.io/firefly
Apache License 2.0
194 stars 30 forks source link

Client should use the path from function specs when calling a remote function #58

Closed anandology closed 7 years ago

anandology commented 7 years ago

The client currently constructs the path to request by appending the function name to the base_url, even though the server specified a separate path for that function.

For example, if we start a server using the following configuration, the client will not be able to call the function hello.

functions:
    hello:
        path: /h
        function: hello.hello
palnabarun commented 7 years ago

I think we can save a func_name -> path mapping in the Client object upon instantiation. When client.call_func would get executed, it would lookup the mapping and point to the right path.

The drawback I could think now is that if there are any changes to the config in the server side, the client needs to be instantiated again. This can be evaded by calling refreshing the mapping on every request.

What are your views @anandology ?

anandology commented 7 years ago

cache them once and provide a reload function to force reload.