Enhance TFChain Service

Open
#1,123 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
dart
Domain
networking

Research direction

No files or tests are named. Start by locating the TFChain service and the getProposals entry point, then review how QueryClient instances and network operations are handled across its functions. Done means connections are reused or pooled and network calls have appropriate timeouts and error handling.

Written by the indexing model from the issue text.

Description

  • Every function creates new client connections without pooling or reuse
  • Network calls can hang indefinitely, causing app freezes
  • Add .timeout() to all network operations
Future<Map<String, List<Proposal>>> getProposals() async {
  final chainUrl = Globals().chainUrl;
  final client = TFChain.QueryClient(chainUrl);
  try {
    await client.connect().timeout(Duration(seconds: 30));
    final proposals = await client.dao.get().timeout(Duration(seconds: 15));
    return proposals;
  } on TimeoutException {
    throw Exception('Request timed out while getting DAO proposals');
  } on SocketException {
    throw Exception('Network error while getting DAO proposals');
  } catch (e) {
    throw Exception('Failed to get DAO proposals: ${e.toString()}');
  } 
}
Dominant language
Dart
Stars
9
Forks
5
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from threefoldtech/grid_connect

All issues in threefoldtech/grid_connect

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.