forked from cwtch.im/cwtch
Merge branch 'storagebugfix' of cwtch.im/cwtch into master
This commit is contained in:
commit
742d36734b
|
@ -36,6 +36,9 @@ func NewProfileStore(eventManager *event.Manager, directory, password string, pr
|
||||||
os.Mkdir(directory, 0700)
|
os.Mkdir(directory, 0700)
|
||||||
ps := &profileStore{fs: NewFileStore(directory, profileFilename, password), password: password, directory: directory, profile: profile, eventManager: eventManager, streamStores: map[string]StreamStore{}}
|
ps := &profileStore{fs: NewFileStore(directory, profileFilename, password), password: password, directory: directory, profile: profile, eventManager: eventManager, streamStores: map[string]StreamStore{}}
|
||||||
ps.queue = event.NewEventQueue(100)
|
ps.queue = event.NewEventQueue(100)
|
||||||
|
if profile != nil {
|
||||||
|
ps.save()
|
||||||
|
}
|
||||||
go ps.eventHandler()
|
go ps.eventHandler()
|
||||||
|
|
||||||
ps.eventManager.Subscribe(event.BlockPeer, ps.queue.EventChannel)
|
ps.eventManager.Subscribe(event.BlockPeer, ps.queue.EventChannel)
|
||||||
|
|
|
@ -20,8 +20,6 @@ func TestProfileStoreWriteRead(t *testing.T) {
|
||||||
profile := NewProfile(testProfileName)
|
profile := NewProfile(testProfileName)
|
||||||
ps1 := NewProfileStore(eventBus, testingDir, password, profile)
|
ps1 := NewProfileStore(eventBus, testingDir, password, profile)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
eventBus.Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{event.Key: testKey, event.Data: testVal}))
|
eventBus.Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{event.Key: testKey, event.Data: testVal}))
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue