Giter Site home page Giter Site logo

Comments (4)

shima-park avatar shima-park commented on May 23, 2024

确实有这个问题

你的需求是不是只需要启动时读取一次,并不需要持续监听配置
如果是这样的话,有个简单的办法修复,只在Watch时去启动监听。

如果是在Watch后,需要去关闭agollo 就不太好处理,实例被隐藏在viper后面

from agollo.

hulb avatar hulb commented on May 23, 2024

也不是,我也需要持续监听配置。只是在主程序退出时希望agollo也可以stop,毕竟有个goroutine在那里。我看remote那里所有的agollo都放在remote.agolloMap里,简单加个退出方法是不是就可以了:

remote.go

func StopAll() {
	agolloMap.Range(func(key, value interface{}) bool {
		value.(agollo.Agollo).Stop()
		return true
	})
}

但是agollo.longPoll会有被hold的情况,这种好像不一定够

from agollo.

shima-park avatar shima-park commented on May 23, 2024

主进程退出后,这些监听的goroutine也会消亡,其实不用太在意

这样也考虑过,是可以这么做。longPoll最坏情况下,对应的那个agollo实例,90秒后也会退出,也还好。
主要是viper没要求ConfigManager实现Close方法,绕开它主动关闭,会有些奇怪。

from agollo.

hulb avatar hulb commented on May 23, 2024

嗯,我不是太清楚主进程退出后监听goroutine相关的资源会不会被正常回收,stopCh还好,longPoll里面涉及到网络了不是太安心。viper接口里增加Close就好了,我先关issue吧,谢谢您抽空解答。

from agollo.

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.