Skip to content

Ability to add endpoints and redefine functions without restarting #65

@tk3369

Description

@tk3369

First, I ran the process async. Then, I want to either a new function but it came back with the world age issue.

julia> apiresponder = APIResponder("tcp://0.0.0.0:8890")
JuliaWebAPI.APIResponder with endpoints:

julia> function testfn1(arg1, arg2; narg1="1", narg2="2")
           return (parse(Int, arg1) * parse(Int, narg1)) + (parse(Int, arg2) * parse(Int, narg2))
       end
testfn1 (generic function with 1 method)

julia> register(apiresponder, testfn1)
JuliaWebAPI.APIResponder with endpoints:
"testfn1"

julia> process(apiresponder; async=true)
JuliaWebAPI.APIResponder with endpoints:
"testfn1"

Now, add and register a new function:

julia> testfn4(arg1, arg2) = test1(args1, args2)
testfn4 (generic function with 1 method)

julia> register(apiresponder, testfn4)
JuliaWebAPI.APIResponder with endpoints:
"testfn1", "testfn4"

Hit the testfn4 url and got this exception:

julia> 29-Mar 23:40:30:ERROR:root:api_exception: MethodError: no method matching testfn4(::String, ::String)
The applicable method may be too new: running in world age 21847, while current world is 21848.
Closest candidates are:
  testfn4(::Any, ::Any) at REPL[7]:1 (method too new to be called from this world context.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions