{"action":"created","issue":{"url":"https://api.github.com/repos/flutter/flutter/issues/23531","repository_url":"https://api.github.com/repos/flutter/flutter","labels_url":"https://api.github.com/repos/flutter/flutter/issues/23531/labels{/name}","comments_url":"https://api.github.com/repos/flutter/flutter/issues/23531/comments","events_url":"https://api.github.com/repos/flutter/flutter/issues/23531/events","html_url":"https://github.com/flutter/flutter/pull/23531","id":374128832,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI1OTAwODgz","number":23531,"title":"[O] Remove many timeouts.","user":{"login":"Hixie","id":551196,"node_id":"MDQ6VXNlcjU1MTE5Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/551196?v=4","gravatar_id":"","url":"https://api.github.com/users/Hixie","html_url":"https://github.com/Hixie","followers_url":"https://api.github.com/users/Hixie/followers","following_url":"https://api.github.com/users/Hixie/following{/other_user}","gists_url":"https://api.github.com/users/Hixie/gists{/gist_id}","starred_url":"https://api.github.com/users/Hixie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hixie/subscriptions","organizations_url":"https://api.github.com/users/Hixie/orgs","repos_url":"https://api.github.com/users/Hixie/repos","events_url":"https://api.github.com/users/Hixie/events{/privacy}","received_events_url":"https://api.github.com/users/Hixie/received_events","type":"User","site_admin":false},"labels":[{"id":487496476,"node_id":"MDU6TGFiZWw0ODc0OTY0NzY=","url":"https://api.github.com/repos/flutter/flutter/labels/cla:%20yes","name":"cla: yes","color":"ffffff","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-25T20:54:57Z","updated_at":"2018-10-26T21:18:17Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/flutter/flutter/pulls/23531","html_url":"https://github.com/flutter/flutter/pull/23531","diff_url":"https://github.com/flutter/flutter/pull/23531.diff","patch_url":"https://github.com/flutter/flutter/pull/23531.patch"},"body":"These are essentially self-inflicted race conditions. Instead of timeouts we're going to try a more verbose logging mechanism that points out when things are taking a long time."},"comment":{"url":"https://api.github.com/repos/flutter/flutter/issues/comments/433546329","html_url":"https://github.com/flutter/flutter/pull/23531#issuecomment-433546329","issue_url":"https://api.github.com/repos/flutter/flutter/issues/23531","id":433546329,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzU0NjMyOQ==","user":{"login":"tvolkert","id":15253456,"node_id":"MDQ6VXNlcjE1MjUzNDU2","avatar_url":"https://avatars0.githubusercontent.com/u/15253456?v=4","gravatar_id":"","url":"https://api.github.com/users/tvolkert","html_url":"https://github.com/tvolkert","followers_url":"https://api.github.com/users/tvolkert/followers","following_url":"https://api.github.com/users/tvolkert/following{/other_user}","gists_url":"https://api.github.com/users/tvolkert/gists{/gist_id}","starred_url":"https://api.github.com/users/tvolkert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tvolkert/subscriptions","organizations_url":"https://api.github.com/users/tvolkert/orgs","repos_url":"https://api.github.com/users/tvolkert/repos","events_url":"https://api.github.com/users/tvolkert/events{/privacy}","received_events_url":"https://api.github.com/users/tvolkert/received_events","type":"User","site_admin":false},"created_at":"2018-10-26T21:18:17Z","updated_at":"2018-10-26T21:18:17Z","author_association":"CONTRIBUTOR","body":"In many (most?) cases, these timeouts were added to alert the developer that something is likely wrong.  That use case is solved by logging trace statements (or warnings), but this PR doesn't always ensure that such logging will take place.\r\n\r\nWhat if we introduced something like the following:\r\n\r\n```dart\r\ntypedef LogFunction = void Function(int attempt, Duration interval);\r\n\r\nvoid _defaultMonitorLog(int attempt, Duration interval) {\r\n  final Duration elapsed = attempt & interval;\r\n  print('Future is taking too long ($elapsed)');\r\n}\r\n\r\n/// Monitors the specified [future], logging a message (via [log])\r\n/// periodically (according to [interval]) if the future is taking too\r\n/// long to complete.\r\nFuture<T> monitor(\r\n  Future<T> future,\r\n  Duration interval, {\r\n  LogFunction log = _defaultMonitorLog,\r\n}) async {\r\n  assert(future != null);\r\n  assert(interval != null);\r\n  assert(interval > Duration.zero);\r\n  int attempt = 1;\r\n  while (true) {\r\n    try {\r\n      return await future.timeout(interval);\r\n    } on TimeoutException {\r\n      log(attempt);\r\n      attempt++;\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nThen in cases where logging could be useful (most cases I'm guessing), we could call:\r\n\r\n*Before*:\r\n\r\n```dart\r\nawait foo.timeout(const Duration(minutes: 1));\r\n```\r\n\r\n*After*:\r\n\r\n```dart\r\nawait monitor(foo, const Duration(minutes: 1));\r\n```\r\n"}}
{"actor":{"display_login":"tvolkert"}}