Commit 1ebbd291 authored by Axel Kingsley's avatar Axel Kingsley Committed by GitHub

use RWMap for Supervisor Backend (#12785)

* use RWMap for Supervisor Backend

* adjust Clear method
parent 39dc0794
...@@ -46,3 +46,10 @@ func (m *RWMap[K, V]) Range(f func(key K, value V) bool) { ...@@ -46,3 +46,10 @@ func (m *RWMap[K, V]) Range(f func(key K, value V) bool) {
} }
} }
} }
// Clear removes all key-value pairs from the map.
func (m *RWMap[K, V]) Clear() {
m.mu.Lock()
defer m.mu.Unlock()
clear(m.inner)
}
This diff is collapsed.
...@@ -117,7 +117,8 @@ func TestBackendLifetime(t *testing.T) { ...@@ -117,7 +117,8 @@ func TestBackendLifetime(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
// Make the processing happen, so we can rely on the new chain information, // Make the processing happen, so we can rely on the new chain information,
// and not run into errors for future data that isn't mocked at this time. // and not run into errors for future data that isn't mocked at this time.
b.chainProcessors[chainA].ProcessToHead() proc, _ := b.chainProcessors.Get(chainA)
proc.ProcessToHead()
_, err = b.UnsafeView(context.Background(), chainA, types.ReferenceView{}) _, err = b.UnsafeView(context.Background(), chainA, types.ReferenceView{})
require.ErrorIs(t, err, types.ErrFuture, "still no data yet, need cross-unsafe") require.ErrorIs(t, err, types.ErrFuture, "still no data yet, need cross-unsafe")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment