Skip to content

fix: can not resuce bytes queue#218

Draft
mangotree2 wants to merge 1 commit intoallegro:mainfrom
mangotree2:master
Draft

fix: can not resuce bytes queue#218
mangotree2 wants to merge 1 commit intoallegro:mainfrom
mangotree2:master

Conversation

@mangotree2
Copy link
Copy Markdown

@mangotree2 mangotree2 commented Apr 29, 2020

fix this:
`

// given
	cache, _ := bigcache.NewBigCache(bigcache.Config{
		Shards:             1,
		LifeWindow:         5 * time.Second,
		MaxEntriesInWindow: 2,
		MaxEntrySize:       400,
		HardMaxCacheSize:   1,
		Verbose:true,
	})

	// when
	_ = cache.Set("key1", blob('a', 1024*400))
	_ = cache.Set("key2", blob('b', 1024*400))
	_ = cache.Set("key3", blob('c', 1024*400))
	key4Err := cache.Set("key4", blob('d', 1024*400))
	if key4Err != nil {
		panic(key4Err)
	}

`

@mangotree2 mangotree2 force-pushed the master branch 2 times, most recently from b109437 to e544d8d Compare April 29, 2020 06:08
Change-Id: Id068d2a9baf44a9e4e8941464c0316aa0965ac4f
@siennathesane
Copy link
Copy Markdown
Collaborator

@mangotree2 would you be able to provide more context on what you're trying to fix? I don't understand the context of the problem nor the context of the proposed fix.

@mangotree2
Copy link
Copy Markdown
Author

@mxplusb @neal-zhu
When maxCapacity is set and the queue is full, head will be equal to tail, and full will be set to true. When Push, canInsertAfterTail and canInsertBeforeHead will judge that the queue is full, it will remove the entry, but will not reset the full field, resulting in After the entry is removed, there is no room.
Can run my test case,but I can’t modify it correctly - -

@siennathesane
Copy link
Copy Markdown
Collaborator

I'm going to convert this to a draft so you can continue working on it until the tests pass. :)

@siennathesane siennathesane marked this pull request as draft May 6, 2020 21:20
@cristaloleg
Copy link
Copy Markdown
Collaborator

@mangotree2 kindly ping 😉

@mangotree2
Copy link
Copy Markdown
Author

@mangotree2 kindly ping 😉


555 T.T .

@cristaloleg
Copy link
Copy Markdown
Collaborator

Sorry, what?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants