]> git.ktnx.net Git - mobile-ledger.git/commitdiff
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 f8e262ef93a1d90c4aea46bdf5bdbe856e0a604f..4edf5c126fcd33bb5d5aaf97cbbec257e3c272c3 100644 (file)
@@ -35,11 +35,11 @@ import java.util.Date;
 
 public class UpdateTransactionsTask extends AsyncTask<String, Void, String> {
     protected String doInBackground(String[] filterAccName) {
 
 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();
         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<>();
 
         try {
             ArrayList<TransactionListItem> newList = new ArrayList<>();