Use batches & don't shadow community var
This commit is contained in:
parent
e67592d556
commit
a3c60528ef
|
@ -525,12 +525,7 @@ func (db *Database) GetRecentStickers() (rst *json.RawMessage, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *Database) SetPinnedMailservers(mailservers map[string]string) error {
|
func (db *Database) SetPinnedMailservers(mailservers map[string]string) error {
|
||||||
jsonString, err := json.Marshal(mailservers)
|
return db.SaveSettingField(PinnedMailservers, mailservers)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return db.SaveSettingField(PinnedMailservers, jsonString)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *Database) SetUseMailservers(value bool) error {
|
func (db *Database) SetUseMailservers(value bool) error {
|
||||||
|
|
|
@ -829,17 +829,14 @@ func (m *Messenger) requestCommunityInfoFromMailserver(communityID string, waitF
|
||||||
m.requestedCommunities[communityID] = nil
|
m.requestedCommunities[communityID] = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
now := uint32(m.transport.GetCurrentTime() / 1000)
|
to := uint32(m.transport.GetCurrentTime() / 1000)
|
||||||
monthAgo := now - (86400 * 30)
|
from := to - oneMonthInSeconds
|
||||||
|
|
||||||
_, err := m.performMailserverRequest(func() (*MessengerResponse, error) {
|
_, err := m.performMailserverRequest(func() (*MessengerResponse, error) {
|
||||||
_, _, err := m.RequestHistoricMessagesForFilter(context.Background(),
|
|
||||||
monthAgo,
|
batch := MailserverBatch{From: from, To: to, Topics: []types.TopicType{filter.Topic}}
|
||||||
now,
|
m.logger.Info("Requesting historic")
|
||||||
nil,
|
err := m.processMailserverBatch(batch)
|
||||||
nil,
|
|
||||||
filter,
|
|
||||||
waitForResponse)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -861,7 +858,7 @@ func (m *Messenger) requestCommunityInfoFromMailserver(communityID string, waitF
|
||||||
select {
|
select {
|
||||||
case <-time.After(200 * time.Millisecond):
|
case <-time.After(200 * time.Millisecond):
|
||||||
//send signal to client that message status updated
|
//send signal to client that message status updated
|
||||||
community, err := m.communitiesManager.GetByIDString(communityID)
|
community, err = m.communitiesManager.GetByIDString(communityID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue