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)