Skip to content

Commit

Permalink
Merge pull request #78 from 0xPolygonID/cache_rev_status
Browse files Browse the repository at this point in the history
Cache issuer state for 5 minutes. Cache credential revocation proofs.
  • Loading branch information
demonsh authored May 21, 2024
2 parents 1f14f3b + 08bcbbe commit 23c314c
Show file tree
Hide file tree
Showing 13 changed files with 682 additions and 104 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.21.1
go-version: 1.22.3
- uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
version: v1.58.1
4 changes: 2 additions & 2 deletions .github/workflows/tests-c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
containers:
- 1.21.4-bullseye
- 1.22.3-bookworm
runs-on: ubuntu-22.04
container: golang:${{matrix.containers}}
steps:
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: 1.21.1
go-version: 1.22.3
- uses: actions/cache@v4
with:
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
containers:
- 1.21.4-bullseye
- 1.22.3-bookworm
runs-on: ubuntu-20.04
container: golang:${{ matrix.containers }}
env:
Expand Down
4 changes: 2 additions & 2 deletions badger_cache_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
)

func TestGetPubRemoteDocument(t *testing.T) {
defer mockBadgerLog(t)()
flushCacheDB()
mockBadgerLog(t)
flushCacheDB(t)

cacheEng, err := newBadgerCacheEngine()
require.NoError(t, err)
Expand Down
14 changes: 7 additions & 7 deletions cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ func (t *testBadgerLogger) Debugf(s string, i ...interface{}) {
t.t.Logf("[BADGER DEBUG]"+s, i...)
}

func mockBadgerLog(t testing.TB) func() {
func mockBadgerLog(t testing.TB) {
orig := badgerLogger
badgerLogger = &testBadgerLogger{t, true}
return func() {
t.Cleanup(func() {
badgerLogger = orig
}
})
}

func BenchmarkBadgerWithOpening(b *testing.B) {
Expand All @@ -99,7 +99,7 @@ func BenchmarkBadgerWithoutOpening(b *testing.B) {
}

func TestBadger(t *testing.T) {
defer mockBadgerLog(t)()
mockBadgerLog(t)

dbPath, err := getBadgerPath()
require.NoError(t, err)
Expand All @@ -114,7 +114,7 @@ func TestBadger(t *testing.T) {
}

func TestGetCacheDB(t *testing.T) {
defer mockBadgerLog(t)()
mockBadgerLog(t)
db1, close1, err := getCacheDB()
require.NoError(t, err)
db2, close2, err := getCacheDB()
Expand Down Expand Up @@ -179,7 +179,7 @@ func set(db *badger.DB, key string, value string) {
}

func TestCleanCache(t *testing.T) {
defer mockBadgerLog(t)()
mockBadgerLog(t)
db1, close1, err := getCacheDB()
require.NoError(t, err)

Expand Down Expand Up @@ -214,7 +214,7 @@ func TestCleanCache(t *testing.T) {
}

func TestMultipleCleanup(t *testing.T) {
defer mockBadgerLog(t)()
mockBadgerLog(t)
_, close1, err := getCacheDB()
require.NoError(t, err)

Expand Down
Loading

0 comments on commit 23c314c

Please sign in to comment.