From ffa2144b9fc3701a740d678c978857e9d98b03d6 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Mon, 4 Feb 2019 11:17:33 -0800 Subject: [PATCH] Save initial profile store --- storage/profile_store.go | 3 +++ storage/profile_store_test.go | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/storage/profile_store.go b/storage/profile_store.go index 39a2291..0597004 100644 --- a/storage/profile_store.go +++ b/storage/profile_store.go @@ -36,6 +36,9 @@ func NewProfileStore(eventManager *event.Manager, directory, password string, pr os.Mkdir(directory, 0700) ps := &profileStore{fs: NewFileStore(directory, profileFilename, password), password: password, directory: directory, profile: profile, eventManager: eventManager, streamStores: map[string]StreamStore{}} ps.queue = event.NewEventQueue(100) + if profile != nil { + ps.save() + } go ps.eventHandler() ps.eventManager.Subscribe(event.BlockPeer, ps.queue.EventChannel) diff --git a/storage/profile_store_test.go b/storage/profile_store_test.go index 5b3b131..7e2fcb5 100644 --- a/storage/profile_store_test.go +++ b/storage/profile_store_test.go @@ -20,8 +20,6 @@ func TestProfileStoreWriteRead(t *testing.T) { profile := NewProfile(testProfileName) ps1 := NewProfileStore(eventBus, testingDir, password, profile) - - eventBus.Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{event.Key: testKey, event.Data: testVal})) time.Sleep(1 * time.Second)