Giter Site home page Giter Site logo

gopromise's Introduction

Go Promise

一个仿照 JavaScript 中 Promise 风格的 Go 语言异步任务框架。

Promise 风格

除了下述的不同点外,其余特性与 JavaScript 中的 Promise 保持一致。

不同点:

  1. 由于 Go 语言的 强类型 特性,成功值无法在 Promise 链条上持续传递,只能传递到下一个节点。

用法

具体的用法体现在测试用例中:

同一个任务受到多个并发度控制

无论结果如何,只会被执行一次的任务

  • 通过构造任务之间的依赖关系来创建任务链
  • 给任务设置超时

受单个并发度控制的任务

同一时间只会有一个任务在执行,但可以接受多次结果请求,任务结束后统一发布结果的“共享任务”

  • 创建定时任务
  • 更改定时任务的计划运行次数
  • 更改定时任务的运行时间间隔

当异步任务在被执行的过程中引发了 Segmentation fault,会自动被 Catch 分支捕捉到

gopromise's People

Contributors

telephonetan avatar

Watchers

 avatar

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.