Skip to content

Commit 7a8e352

Browse files
committed
cleanup
1 parent 33fdaa0 commit 7a8e352

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

firebase-database/src/androidTest/java/com/google/firebase/database/QueryTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -3431,7 +3431,6 @@ public void offlineQueryGet() throws DatabaseException, InterruptedException {
34313431
FirebaseApp app =
34323432
appForDatabaseUrl(IntegrationTestValues.getNamespace(), UUID.randomUUID().toString());
34333433
FirebaseDatabase db = FirebaseDatabase.getInstance(app);
3434-
db.setLogLevel(Logger.Level.DEBUG);
34353434
DatabaseReference node = db.getReference();
34363435
db.goOffline();
34373436
try {

firebase-database/src/main/java/com/google/firebase/database/connection/PersistentConnectionImpl.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,16 @@ private Map<String, Object> getRequest() {
132132
return request;
133133
}
134134

135+
/**
136+
* Mark this OutstandingGet as sent. Essentially compare-and-set on the `sent` member.
137+
*
138+
* @return true if the OustandingGet wasn't already sent, false if it was.
139+
*/
135140
private boolean markSent() {
136-
boolean prev = sent;
137-
if (prev) {
141+
if (sent) {
138142
return false;
139143
}
140-
this.sent = true;
144+
sent = true;
141145
return true;
142146
}
143147
}
@@ -418,8 +422,7 @@ public void onResponse(Map<String, Object> response) {
418422
new Runnable() {
419423
@Override
420424
public void run() {
421-
OutstandingGet get = outstandingGets.get(readId);
422-
if (get == null || get != outstandingGet || !get.markSent()) {
425+
if (!outstandingGet.markSent()) {
423426
return;
424427
}
425428
if (logger.logsDebug()) {

0 commit comments

Comments
 (0)