increment the background task counter immediately before starting the task
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 5 Mar 2019 19:18:39 +0000 (21:18 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 5 Mar 2019 19:18:39 +0000 (21:18 +0200)
so that the try/finally construct guarantees the correct counting

app/src/main/java/net/ktnx/mobileledger/async/UpdateTransactionsTask.java

index f8e262e..4edf5c1 100644 (file)
@@ -35,11 +35,11 @@ import java.util.Date;
 
 public class UpdateTransactionsTask extends AsyncTask<String, Void, String> {
     protected String doInBackground(String[] filterAccName) {
-        Data.backgroundTaskCount.incrementAndGet();
         final MobileLedgerProfile profile = Data.profile.get();
         if (profile == null) return "Profile not configured";
 
         String profile_uuid = profile.getUuid();
+        Data.backgroundTaskCount.incrementAndGet();
         try {
             ArrayList<TransactionListItem> newList = new ArrayList<>();