fix(market): recover by itself when the shared connection comes up
Fresh installs could sit on 'can't reach the servers' forever: the offers cubit captured the transport once at build time, the shared connection only retried on a connectivity CHANGE, and a silently-filtered relay could stall the pool for minutes. - SocialConnection: retry with backoff after a failed attempt while started and not knowingly offline (injectable schedule for tests) - OffersCubit: follow connection.sessions, re-attach the transport and re-run the last discovery on (re)connect; announce drops via connectionEpoch - market _init: record the wanted area on the cubit even while offline - NostrOfferTransport.discoverPage: sort a copy (channel lists may be unmodifiable)
This commit is contained in:
parent
981cf10048
commit
8a7dc8d3dc
6 changed files with 273 additions and 9 deletions
|
|
@ -46,9 +46,10 @@ class NostrOfferTransport implements OfferTransport {
|
|||
|
||||
@override
|
||||
Future<OfferPage> discoverPage(DiscoveryQuery query) async {
|
||||
final events = await _conn.reqOnce(_filter(query))
|
||||
// Newest first; the relays dedup within themselves and reqOnce dedups
|
||||
// across them, but order is not guaranteed, so sort here.
|
||||
// Newest first; the relays dedup within themselves and reqOnce dedups
|
||||
// across them, but order is not guaranteed, so sort here — on a copy, as
|
||||
// the channel may hand out an unmodifiable list.
|
||||
final events = [...await _conn.reqOnce(_filter(query))]
|
||||
..sort((a, b) => b.createdAt.compareTo(a.createdAt));
|
||||
final offers = <Offer>[];
|
||||
for (final e in events) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue