8000 Fix crash when capacity is set to 0 in cache by sundowndev Β· Pull Request #589 Β· snyk/driftctl Β· GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix crash when capacity is set to 0 in cache #589

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

Merged
merged 1 commit into from
Jun 4, 2021
Merged

Conversation

sundowndev
Copy link
Contributor
@sundowndev sundowndev commented Jun 4, 2021
Q A
πŸ› Bug fix? yes
πŸš€ New feature? no
⚠ Deprecations? no
❌ BC Break no
πŸ”— Related issues #...
❓ Documentation no

Description

In some cases, we may want to not use the cache although it's required. It may be for testing purposes or simply because of a technical limitation. We already use a capacity of 0 in supplier unit tests, because we don't need to cache values. For now, a capacity of 0 result in a nil pointer dereference error. This PR fixes the issue simply by ignoring keys when capacity is set to 0.

@sundowndev sundowndev added the kind/maintenance Refactoring or changes to the workspace label Jun 4, 2021
@sundowndev sundowndev self-assigned this Jun 4, 2021
@sundowndev sundowndev changed the title Allow capacity of 0 in cache Fix crash when capacity is set to 0 in cache Jun 4, 2021
@codecov
Copy link
codecov bot commented Jun 4, 2021

Codecov Report

Merging #589 (26dcfd2) into main (6687a2a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #589   +/-   ##
=======================================
  Coverage   71.94%   71.95%           
=======================================
  Files         196      196           
  Lines        5825     5827    +2     
=======================================
+ Hits         4191     4193    +2     
  Misses       1381     1381           
  Partials      253      253           
Impacted Files Coverage Ξ”
pkg/remote/cache/cache.go 100.00% <100.00%> (ΓΈ)

@sundowndev sundowndev marked this pull request as ready for review June 4, 2021 09:12
@sundowndev sundowndev requested a review from a team as a code owner June 4, 2021 09:12
lotoussa
lotoussa previously approved these changes Jun 4, 2021
@sundowndev sundowndev force-pushed the feat/cacheCapacity branch from 1d53724 to 26dcfd2 Compare June 4, 2021 13:40
@wbeuil wbeuil merged commit 6e5370a into main Jun 4, 2021
@wbeuil wbeuil deleted the feat/cacheCapacity branch June 4, 2021 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/maintenance Refactoring or changes to the workspace
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0