Use batches & don't shadow community var

This commit is contained in:
Andrea Maria Piana 2022-03-23 18:57:57 +00:00
parent e67592d556
commit a3c60528ef
3 changed files with 9 additions and 17 deletions

View File

@ -1 +1 @@
0.97.0
0.97.1

View File

@ -525,12 +525,7 @@ func (db *Database) GetRecentStickers() (rst *json.RawMessage, err error) {
}
func (db *Database) SetPinnedMailservers(mailservers map[string]string) error {
jsonString, err := json.Marshal(mailservers)
if err != nil {
return err
}
return db.SaveSettingField(PinnedMailservers, jsonString)
return db.SaveSettingField(PinnedMailservers, mailservers)
}
func (db *Database) SetUseMailservers(value bool) error {

View File

@ -829,17 +829,14 @@ func (m *Messenger) requestCommunityInfoFromMailserver(communityID string, waitF
m.requestedCommunities[communityID] = nil
}
now := uint32(m.transport.GetCurrentTime() / 1000)
monthAgo := now - (86400 * 30)
to := uint32(m.transport.GetCurrentTime() / 1000)
from := to - oneMonthInSeconds
_, err := m.performMailserverRequest(func() (*MessengerResponse, error) {
_, _, err := m.RequestHistoricMessagesForFilter(context.Background(),
monthAgo,
now,
nil,
nil,
filter,
waitForResponse)
batch := MailserverBatch{From: from, To: to, Topics: []types.TopicType{filter.Topic}}
m.logger.Info("Requesting historic")
err := m.processMailserverBatch(batch)
return nil, err
})
if err != nil {
@ -861,7 +858,7 @@ func (m *Messenger) requestCommunityInfoFromMailserver(communityID string, waitF
select {
case <-time.After(200 * time.Millisecond):
//send signal to client that message status updated
community, err := m.communitiesManager.GetByIDString(communityID)
community, err = m.communitiesManager.GetByIDString(communityID)
if err != nil {
return nil, err
}