Coder Social home page Coder Social logo

Comments (11)

cheikhshift avatar cheikhshift commented on June 14, 2024

Would it be possible to keep panics and catch them by deferring a call to function recover?
I searched through the code, there are os.Exit invocations in vendor packages and 4 within Derek

from derek.

alexellis avatar alexellis commented on June 14, 2024

It would be possible, but I think we could change the code as part of this instead. Can you link to the instances (with line number) please?

from derek.

cheikhshift avatar cheikhshift commented on June 14, 2024

These are the calls to os.Exit within Derek, there are more from vendor packages :

https://github.com/alexellis/derek/blob/master/main.go#L34

https://github.com/alexellis/derek/blob/master/main.go#L40

https://github.com/alexellis/derek/blob/master/main.go#L47

https://github.com/alexellis/derek/blob/master/main.go#L55

from derek.

alexellis avatar alexellis commented on June 14, 2024

Thanks for the research.

Do you want to try doing this issue first? #97

For the line numbers you can click the line on GitHub's UI and then copy/paste the URL.

from derek.

cheikhshift avatar cheikhshift commented on June 14, 2024

Sure, I updated my previous comment with links to the corresponding line.

from derek.

alexellis avatar alexellis commented on June 14, 2024

@cheikhshift are you still working on this? 😄

from derek.

cheikhshift avatar cheikhshift commented on June 14, 2024

from derek.

alexellis avatar alexellis commented on June 14, 2024

Can you propose a PR?

Alex

from derek.

cheikhshift avatar cheikhshift commented on June 14, 2024

from derek.

cheikhshift avatar cheikhshift commented on June 14, 2024

I reviewed the issue, this is what I'm going to work on :

  • isolate most of the main.go file (in package root) in a new sub package called handler.
  • Modify the current OpenFaaS deployment file to use the Go template.
  • We need to keep invocations to panic, as they can modify response code provided by OpenFaaS. Some dependencies make invocations to os.Exit, but as long as derek is not using any deprecated functions, things should be fine.
    PR to follow soon.

Since I've mentioned HTTP responses, OpenFaas should have a helper package, to provide a sort of translation of how OpenFaaS interfaces with HTTP requests. This may reduce friction for users coming from a RESTful API background.

from derek.

alexellis avatar alexellis commented on June 14, 2024

Thanks for your take on the changes. We have a REST-compatible template called golang-http and golang-middleware both are available via faas-cli template store list and would have the benefit of keeping Derek's process alive between requests.

from derek.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.