当前位置: 首页>>代码示例>>Golang>>正文


Golang Config.PruneStaleDropletsInterval方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry/gorouter/config.Config.PruneStaleDropletsInterval方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.PruneStaleDropletsInterval方法的具体用法?Golang Config.PruneStaleDropletsInterval怎么用?Golang Config.PruneStaleDropletsInterval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry/gorouter/config.Config的用法示例。


在下文中一共展示了Config.PruneStaleDropletsInterval方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

	"github.com/cloudfoundry/yagnats/fakeyagnats"

	"encoding/json"
	"time"
)

var _ = Describe("RouteRegistry", func() {
	var r *RouteRegistry
	var messageBus *fakeyagnats.FakeYagnats

	var fooEndpoint, barEndpoint, bar2Endpoint *route.Endpoint
	var configObj *config.Config

	BeforeEach(func() {
		configObj = config.DefaultConfig()
		configObj.PruneStaleDropletsInterval = 50 * time.Millisecond
		configObj.DropletStaleThreshold = 10 * time.Millisecond

		messageBus = fakeyagnats.New()
		r = NewRouteRegistry(configObj, messageBus)
		fooEndpoint = route.NewEndpoint("12345", "192.168.1.1", 1234,
			"id1", map[string]string{
				"runtime":   "ruby18",
				"framework": "sinatra",
			})

		barEndpoint = route.NewEndpoint("54321", "192.168.1.2", 4321,
			"id2", map[string]string{
				"runtime":   "javascript",
				"framework": "node",
			})
开发者ID:tomzhang,项目名称:golang-devops-stuff,代码行数:31,代码来源:registry_test.go

示例2:

		client    *fake_routing_api.FakeClient

		token *schema.Token

		response     []db.Route
		process      ifrit.Process
		eventChannel chan routing_api.Event
		errorChannel chan error

		clock *fakeclock.FakeClock
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")
		cfg = config.DefaultConfig()
		cfg.PruneStaleDropletsInterval = 2 * time.Second

		retryInterval := 0
		uaaClient = &testUaaClient.FakeClient{}
		registry = &testRegistry.FakeRegistryInterface{}

		token = &schema.Token{
			AccessToken: "access_token",
			ExpiresIn:   5,
		}
		client = &fake_routing_api.FakeClient{}

		eventChannel = make(chan routing_api.Event)
		errorChannel = make(chan error)
		eventSource := fake_routing_api.FakeEventSource{}
		client.SubscribeToEventsWithMaxRetriesReturns(&eventSource, nil)
开发者ID:nagyistge,项目名称:gorouter,代码行数:31,代码来源:route_fetcher_test.go

示例3:

		Context("When the token fetcher returns an error", func() {
			BeforeEach(func() {
				tokenFetcher.FetchTokenReturns(nil, errors.New("token fetcher error"))
			})

			It("returns an error", func() {
				err := fetcher.FetchRoutes()
				Expect(err).To(HaveOccurred())
				Expect(registry.RegisterCallCount()).To(Equal(0))
			})
		})
	})

	Describe(".StartFetchCycle", func() {
		BeforeEach(func() {
			cfg.PruneStaleDropletsInterval = 10 * time.Millisecond
			fetcher = NewRouteFetcher(logger, tokenFetcher, registry, cfg, client, retryInterval)

			tokenFetcher.FetchTokenReturns(token, nil)

			client.RoutesReturns(response, nil)
		})

		It("periodically fetches routes", func() {
			received := make(chan struct{})

			client.RoutesStub = func() ([]db.Route, error) {
				received <- struct{}{}
				return []db.Route{}, nil
			}
开发者ID:krumts,项目名称:gorouter,代码行数:30,代码来源:route_fetcher_test.go


注:本文中的github.com/cloudfoundry/gorouter/config.Config.PruneStaleDropletsInterval方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。