Giter Site home page Giter Site logo

go-algorithm's Introduction

Hi there 👋

嗨,大家好,我是asong,一名普普通通程序员。目前从事Golang后端开发。

联系我:

go-algorithm's People

Contributors

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

Watchers

 avatar  avatar

go-algorithm's Issues

分段发号算法实现问题

请问下,为啥不直接用channel去实现呢,把从db申请成功的 分段号[min,max]丢到channel,当channel不满时,生产者就往里面放新的分段,消费者从里面取出分段号进行分配, 感觉这种实现是不是会简单很多呢?

LeafService的GetID方法有可能死锁

func (l *LeafService) GetID(ctx context.Context, bizTag string) (uint64, error) {
	// 先去内存中看一下是否已经初始了,未初始化则开启兜底策略初始化一下。
	l.mutex.Lock()
	var err error
	seqs := l.leafSeq.Get(bizTag)
	if seqs == nil {
		// 不存在初始化一下
		seqs, err = l.InitCache(ctx, bizTag)
		if err != nil {
			return 0, err
		}
	}
	l.mutex.Unlock()

方法有可能在Unlock前返回

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.