msgstore_fs: abort on timeout
This commit is contained in:
parent
ce69f00e3f
commit
193c0afd69
@ -497,6 +497,10 @@ func (ms *fsMessageStore) LoadBeforeTime(ctx context.Context, network *Network,
|
|||||||
remaining -= len(buf)
|
remaining -= len(buf)
|
||||||
year, month, day := start.Date()
|
year, month, day := start.Date()
|
||||||
start = time.Date(year, month, day, 0, 0, 0, 0, start.Location()).Add(-1)
|
start = time.Date(year, month, day, 0, 0, 0, 0, start.Location()).Add(-1)
|
||||||
|
|
||||||
|
if err := ctx.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return history[remaining:], nil
|
return history[remaining:], nil
|
||||||
@ -522,6 +526,10 @@ func (ms *fsMessageStore) LoadAfterTime(ctx context.Context, network *Network, e
|
|||||||
remaining -= len(buf)
|
remaining -= len(buf)
|
||||||
year, month, day := start.Date()
|
year, month, day := start.Date()
|
||||||
start = time.Date(year, month, day+1, 0, 0, 0, 0, start.Location())
|
start = time.Date(year, month, day+1, 0, 0, 0, 0, start.Location())
|
||||||
|
|
||||||
|
if err := ctx.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return history, nil
|
return history, nil
|
||||||
}
|
}
|
||||||
@ -565,6 +573,10 @@ func (ms *fsMessageStore) LoadLatestID(ctx context.Context, network *Network, en
|
|||||||
remaining -= len(buf)
|
remaining -= len(buf)
|
||||||
year, month, day := t.Date()
|
year, month, day := t.Date()
|
||||||
t = time.Date(year, month, day, 0, 0, 0, 0, t.Location()).Add(-1)
|
t = time.Date(year, month, day, 0, 0, 0, 0, t.Location()).Add(-1)
|
||||||
|
|
||||||
|
if err := ctx.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return history[remaining:], nil
|
return history[remaining:], nil
|
||||||
@ -624,6 +636,10 @@ func (ms *fsMessageStore) ListTargets(ctx context.Context, network *Network, sta
|
|||||||
Name: target,
|
Name: target,
|
||||||
LatestMessage: t,
|
LatestMessage: t,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if err := ctx.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort targets by latest message time, backwards or forwards depending on
|
// Sort targets by latest message time, backwards or forwards depending on
|
||||||
|
Loading…
Reference in New Issue
Block a user