Added chunk size debug option

pull/206/head
M66B 3 years ago
parent 9c2e8526fd
commit 263c1dd1ac

@ -67,7 +67,6 @@ import com.sun.mail.imap.IMAPStore;
import com.sun.mail.imap.protocol.FLAGS;
import com.sun.mail.imap.protocol.FetchResponse;
import com.sun.mail.imap.protocol.IMAPProtocol;
import com.sun.mail.imap.protocol.Namespaces;
import com.sun.mail.imap.protocol.UID;
import com.sun.mail.pop3.POP3Folder;
import com.sun.mail.pop3.POP3Message;
@ -137,10 +136,11 @@ import javax.mail.search.SentDateTerm;
import me.leolin.shortcutbadger.ShortcutBadger;
class Core {
static final int DEFAULT_SYNC_CHUNCK_SIZE = 100;
private static final int MAX_NOTIFICATION_DISPLAY = 10; // per group
private static final int MAX_NOTIFICATION_COUNT = 100; // per group
private static final long SCREEN_ON_DURATION = 3000L; // milliseconds
private static final int SYNC_CHUNCK_SIZE = 100;
private static final int SYNC_BATCH_SIZE = 20;
private static final int DOWNLOAD_BATCH_SIZE = 20;
private static final int SYNC_YIELD_COUNT = 100;
@ -3120,7 +3120,8 @@ class Core {
ranges.add(new Pair<>(first, last < 0 ? first : last));
// https://datatracker.ietf.org/doc/html/rfc2683#section-3.2.1.5
List<List<Pair<Long, Long>>> chunks = Helper.chunkList(ranges, SYNC_CHUNCK_SIZE);
int chunk_size = prefs.getInt("chunk_size", DEFAULT_SYNC_CHUNCK_SIZE);
List<List<Pair<Long, Long>>> chunks = Helper.chunkList(ranges, chunk_size);
Log.i(folder.name + " executing uid fetch count=" + uids.size() +
" ranges=" + ranges.size() + " chunks=" + chunks.size());

@ -135,6 +135,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swCheckpoints;
private TextView tvSqliteCache;
private SeekBar sbSqliteCache;
private TextView tvChunkSize;
private SeekBar sbChunkSize;
private ImageButton ibSqliteCache;
private SwitchCompat swModSeq;
private SwitchCompat swExpunge;
@ -174,7 +176,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"experiments", "crash_reports", "cleanup_attachments",
"protocol", "debug", "log_level",
"query_threads", "wal", "checkpoints", "sqlite_cache",
"use_modseq", "perform_expunge",
"chunk_size", "use_modseq", "perform_expunge",
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl",
"exact_alarms", "dup_msgids", "test_iab"
};
@ -263,6 +265,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvSqliteCache = view.findViewById(R.id.tvSqliteCache);
sbSqliteCache = view.findViewById(R.id.sbSqliteCache);
ibSqliteCache = view.findViewById(R.id.ibSqliteCache);
tvChunkSize = view.findViewById(R.id.tvChunkSize);
sbChunkSize = view.findViewById(R.id.sbChunkSize);
swModSeq = view.findViewById(R.id.swModSeq);
swExpunge = view.findViewById(R.id.swExpunge);
swAuthPlain = view.findViewById(R.id.swAuthPlain);
@ -775,6 +779,27 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
sbChunkSize.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
progress = progress / 10;
if (progress < 1)
progress = 1;
progress = progress * 10;
prefs.edit().putInt("chunk_size", progress).apply();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// Do nothing
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// Do nothing
}
});
swProtocol.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1287,6 +1312,10 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
Helper.humanReadableByteCount(cache_size * 1024L)));
sbSqliteCache.setProgress(sqlite_cache);
int chunk_size = prefs.getInt("chunk_size", Core.DEFAULT_SYNC_CHUNCK_SIZE);
tvChunkSize.setText(getString(R.string.title_advanced_chunk_size, chunk_size));
sbChunkSize.setProgress(chunk_size);
swModSeq.setChecked(prefs.getBoolean("use_modseq", true));
swExpunge.setChecked(prefs.getBoolean("perform_expunge", true));
swAuthPlain.setChecked(prefs.getBoolean("auth_plain", true));

@ -744,6 +744,29 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ibSqliteCache" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvChunkSize"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_chunk_size"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSqliteCacheHint" />
<SeekBar
android:id="@+id/sbChunkSize"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:max="1000"
android:min="0"
android:progress="100"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvChunkSize" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swModSeq"
android:layout_width="0dp"
@ -753,7 +776,7 @@
android:text="@string/title_advanced_modseq"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSqliteCacheHint"
app:layout_constraintTop_toBottomOf="@id/sbChunkSize"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -658,6 +658,7 @@
<string name="title_advanced_wal" translatable="false">WAL</string>
<string name="title_advanced_checkpoints" translatable="false">Checkpoints</string>
<string name="title_advanced_sqlite_cache" translatable="false">Sqlite cache: %1$s %% - %2$s</string>
<string name="title_advanced_chunk_size" translatable="false">Chunk size: %1$d</string>
<string name="title_advanced_modseq" translatable="false">MODSEQ</string>
<string name="title_advanced_expunge" translatable="false">EXPUNGE</string>
<string name="title_advanced_auth_plain" translatable="false">PLAIN</string>

Loading…
Cancel
Save