Giter VIP home page Giter VIP logo

circuitbreaker's Introduction

Kitura

A Swift Web Framework and HTTP Server

Docs Build Status - Master macOS Linux Apache 2 codecov codebeat badge Slack Status

Summary

Kitura is a web framework and web server that is created for web services written in Swift. For more information, visit www.kitura.dev.

Table of Contents

Features

  • URL routing (e.g., GET, POST, PUT, DELETE, PATCH)
  • Codable routing
  • URL parameters
  • Static file serving
  • FastCGI support
  • SSL/TLS support
  • Pluggable middleware

Getting Started

Visit https://www.kitura.dev for a Getting Started guide, tutorials, and API reference documentation.

Contributing to Kitura

All improvements to Kitura are very welcome! Here's how to get started with developing Kitura itself.

  1. Clone this repository.

$ git clone https://github.com/Kitura/Kitura

  1. Build and run tests.

$ swift test

You can find more info on contributing to Kitura in our contributing guidelines.

Notes

  • Swift-NIO is now the default network engine via the Kitura-NIO package. If for some reason you require the old Kitura-net package, you can still enable it by setting an environment variable KITURA_NIO=0 during build.
  • Most Kitura packages have been updated to require at least Swift 5.2 in order to maintain backward compatibility.

Community

We love to talk server-side Swift, and Kitura. Join our Slack to meet the team!

circuitbreaker's People

Contributors

acbodine avatar andrew-lees11 avatar dannys42 avatar djones6 avatar helenmasters avatar ianpartridge avatar kostickm avatar kweinmeister avatar mbarnach avatar rolivieri avatar sandmman avatar shihabmehboob avatar swiftdevops avatar tfrank64 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

circuitbreaker's Issues

Update fallback signature to include BreakerError

Currently the fallback function is of type: AnyFallback<C> = (C) -> Void which allows for a variable number of arguments to be passed by the client when calling the fallback function. The goal is to force the first argument in the list to be of type BreakerError to notify the client if the fallback was called because of a timeout or a fastFail.

For some reason making AnyFallback<C> = (BreakerError, C) -> Void will not allow C to have a variable number of arguments. Need to find a way to fix this issue.

Error with fallback signature and/or README documentation

This seems to be a known issue and one that, in theory, has already been addressed (see #16). But I'm still having issues with the signature for, and invocation of, the fallback function.

The README indicates that the fallback functions's signature should match

(<BreakerError, (fallbackArg1, fallbackArg2,...)>) -> Void

(Unless I'm missing something, the angle brackets are a typo in the README.)

and that the run method on CircuitBreaker should be called as follows:

breaker.run(commandArgs: (a: 10, b: 20), fallbackArgs: (msg: "Something went wrong."))

However, if I create a fallback with the signature (BreakerError, String) -> Void and try to invoke run as indicated above, I get the following error message:

error: cannot convert value of type '(msg: String)' to expected argument type 'String' 
breaker.run(commandArgs: (a: 12, b: 13), fallbackArgs: (msg: "This is a test"))                                                                                
                                                   ^~~~~~~~~~~~~~~~~~~~~~~                                                                                 
                                                                           as! String  

Further, if I create a fallback with the signature (BreakerError, String, String) -> Void and try to invoke run with breaker.run(commandArgs: (a: 10, b: 20), fallbackArgs: (msg, "First Message", msg2: "SecondMessage:)) I receive the following error:

error: cannot convert value of type '(Int, Int) -> Int' to expected argument type '(_) -> (_)'
let breaker = CircuitBreaker(command: myFunc, fallback: myFallback)                                                                                            
                                  ^~~~~~                                                

(Note: the error is with parsing the command, not the fallback.)

I can, however, successfully invoke run as follows:

 breaker.run(commandArgs: (a: 10, b: 20), fallbackArgs: "Something went wrong.")

I haven't yet finished working my way through the source, so that might clear up some mis-understanding on my part. Nevertheless, it seems that the README is definitely incorrect.
Also, it would be very useful to actually be able to pass more than one argument to the fallback function.

Intermittent test failures in Travis

The CircuitBreaker tests appear to have started intermittently failing in Travis. My suspicion is that this is test fragility rather than a real problem, but it ought to be investigated.

Example:
https://api.travis-ci.org/v3/job/461370473/log.txt

Test Case '-[CircuitBreakerTests.CircuitBreakerTests testStateCycle]' started.
/Users/travis/build/IBM-Swift/CircuitBreaker/Tests/CircuitBreakerTests/CircuitBreakerTests.swift:617: error: -[CircuitBreakerTests.CircuitBreakerTests testStateCycle] : XCTAssertEqual failed: ("closed") is not equal to ("open") - 
/Users/travis/build/IBM-Swift/CircuitBreaker/Tests/CircuitBreakerTests/CircuitBreakerTests.swift:620: error: -[CircuitBreakerTests.CircuitBreakerTests testStateCycle] : XCTAssertEqual failed: ("closed") is not equal to ("open") - 
/Users/travis/build/IBM-Swift/CircuitBreaker/Tests/CircuitBreakerTests/CircuitBreakerTests.swift:625: error: -[CircuitBreakerTests.CircuitBreakerTests testStateCycle] : XCTAssertEqual failed: ("closed") is not equal to ("halfopen") - 
Test Case '-[CircuitBreakerTests.CircuitBreakerTests testStateCycle]' failed (1.026 seconds).

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.