Giter Club home page Giter Club logo

go-delay-exec's Introduction

非常简单的go延迟操作脚手架

应用场景:

  • 超三分钟未付款取消订单
  • 超十分钟未接单退款等

用于弥补PHP这样脚本型语言后台运行鸡助的问题

本机测试20000并发请求跑满cpu。 加上业务逻辑可能缩水一点。 但也足够应对中小型项目了。

.
├── cli.go     // 测试并发的客户端
├── README.md  // 说明
└── server.go  // 服务端

Run

go run server.go

url http://{yourhost}/create?orderid=10000

原理

  • 启动一个简单http服务用于被动接收业务
  • 收到业务后异步执行函数
  • 函数中使用Sleep等待触发时间
  • 然后是业务逻辑,异步函数结束

下次更新

  • MySQL增删改查封装进去
  • 数据库连接池

还不太熟悉go语言, 以后熟悉了再弄~

go-delay-exec's People

Contributors

edk24 avatar

Stargazers

 avatar  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.