processAcceptances method
Future<List<({CItem<InvitationAcceptance> acceptance, InvitationOutcome outcome})> >
processAcceptances()
Handles every acceptance of this atSign's pending invitations, and finishes any invitation a client decided but did not finish. Reports each acceptance it handled; one of an invitation already decided is not reported again.
A record it cannot read, or an acceptance it cannot handle, is logged and skipped, so it cannot hold up the others.
An acceptance is judged against the invitation's expiry when it is handled, not when it was sent, since only the invitee vouches for when that was. An invitation that should confirm promptly wants a client of the inviter's running.
Implementation
Future<
List<
({
CItem<InvitationAcceptance> acceptance,
InvitationOutcome outcome
})>> processAcceptances() async {
final results = <({
CItem<InvitationAcceptance> acceptance,
InvitationOutcome outcome
})>[];
final received = [
for (final a in await _readable(await acceptances))
if (a.owner != me) a
];
for (final acceptance in received) {
try {
final outcome = await _process(acceptance);
if (outcome != null) {
results.add((acceptance: acceptance, outcome: outcome));
}
} on StoppedException {
rethrow;
} catch (e) {
logger.warning(
'Could not handle the acceptance ${acceptance.id} from '
'${acceptance.owner}: $e',
);
}
}
await _finishDecided(received);
return results;
}