Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: can not resuce bytes queue #218

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

mangotree2
Copy link

@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
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
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
Collaborator

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

@cristaloleg
Copy link
Collaborator

@mangotree2 kindly ping 😉

@mangotree2
Copy link
Author

@mangotree2 kindly ping 😉


555 T.T .

@cristaloleg
Copy link
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