-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Espresso idling resource for Apollo GraphQL client #469
Changes from 1 commit
7a1664d
3ad4610
1210f32
0dda9b8
51817a7
76780b3
0af44d1
989e102
b68e8e5
ff6fa0d
7158335
873f393
5525529
43a90b6
53801bf
4483920
190ae11
664b033
41dcb1d
72484ae
cbf6574
de9a829
1cc6187
07d4b91
5d23a9f
69a28d5
d934cc0
8d1a6d6
7610a67
c75d4c4
79d2f99
f5ba765
85581e0
7471952
f3f1e48
fa598f1
0d495e1
8133815
1860193
f47672b
c8102ba
dd3cb51
95c9383
f9d36a8
ac1e4a8
516615b
4fab454
57c401d
c4e5ab5
3dad93e
9820c66
2096424
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ public class ApolloCallTracker { | |
private Runnable idleCallback; | ||
|
||
private final Deque<ApolloCall> runningSyncCalls = new ArrayDeque<>(); | ||
private final Deque<RealApolloCall<?>.AsyncCall> runningAsyncCalls = new ArrayDeque<>(); | ||
private final Deque<RealApolloCall.AsyncCall> runningAsyncCalls = new ArrayDeque<>(); | ||
private final Deque<ApolloPrefetch> runningSyncPrefetches = new ArrayDeque<>(); | ||
private final Deque<RealApolloPrefetch.AsyncCall> runningAsyncPrefetches = new ArrayDeque<>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to track async and sync separately ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess so. Don't really have a strong opinion here but I felt that even though sync and async refer to the same object type, it's better to have different deques for tracking async and sync calls, just to keep concerns separate. We don't have a use case right now though wherein we only need to track all the async operations or only the sync operations. If you feel otherwise I'll just go ahead and make the change. |
||
|
||
|
@@ -166,9 +166,9 @@ private void executeCallBackIfCallsAreFinished(int runningCallsCount, Runnable i | |
* Returns a total count of in progress {@link ApolloCall} & {@link ApolloPrefetch} objects. | ||
*/ | ||
public int getRunningCallsCount() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename to |
||
return runningAsyncCalls.size() + | ||
runningSyncCalls.size() + | ||
runningSyncPrefetches.size() + | ||
runningAsyncPrefetches.size(); | ||
return runningAsyncCalls.size() | ||
+ runningSyncCalls.size() | ||
+ runningSyncPrefetches.size() | ||
+ runningAsyncPrefetches.size(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
Deque
can we useLinkedHashSet
I guess it will be better for performance?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think yeah, a
LinkedHashSet
makes more sense here and would give us better performance over aDeque