Move checking if the event has been sent as well
This commit is contained in:
parent
94960c507a
commit
2f99680c38
|
@ -69,6 +69,16 @@ func (r *Inputer) updateLatestEvents(
|
||||||
|
|
||||||
defer sqlutil.EndTransactionWithCheck(updater, &succeeded, &err)
|
defer sqlutil.EndTransactionWithCheck(updater, &succeeded, &err)
|
||||||
|
|
||||||
|
// If the event has already been written to the output log then we
|
||||||
|
// don't need to do anything, as we've handled it already.
|
||||||
|
hasBeenSent, err := updater.HasEventBeenSent(stateAtEvent.EventNID)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("u.updater.HasEventBeenSent: %w", err)
|
||||||
|
}
|
||||||
|
if hasBeenSent {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
u := latestEventsUpdater{
|
u := latestEventsUpdater{
|
||||||
api: r,
|
api: r,
|
||||||
updater: updater,
|
updater: updater,
|
||||||
|
@ -154,14 +164,6 @@ func (u *latestEventsUpdater) doUpdateLatestEvents(ctx context.Context, roomInfo
|
||||||
u.oldLatest = u.updater.LatestEvents()
|
u.oldLatest = u.updater.LatestEvents()
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the event has already been written to the output log then we
|
|
||||||
// don't need to do anything, as we've handled it already.
|
|
||||||
if hasBeenSent, err := u.updater.HasEventBeenSent(u.stateAtEvent.EventNID); err != nil {
|
|
||||||
return nil, fmt.Errorf("u.updater.HasEventBeenSent: %w", err)
|
|
||||||
} else if hasBeenSent {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Work out what the latest events are. This will include the new
|
// Work out what the latest events are. This will include the new
|
||||||
// event if it is not already referenced.
|
// event if it is not already referenced.
|
||||||
extremitiesChanged, err := u.calculateLatest(
|
extremitiesChanged, err := u.calculateLatest(
|
||||||
|
|
Loading…
Reference in a new issue