mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-25 17:47:47 +00:00
Reduce number of optimistic migrations enqueued at once.
This commit is contained in:
@@ -148,7 +148,7 @@ public final class GroupsV1MigrationUtil {
|
|||||||
|
|
||||||
public static void performLocalMigration(@NonNull Context context, @NonNull GroupId.V1 gv1Id) throws IOException
|
public static void performLocalMigration(@NonNull Context context, @NonNull GroupId.V1 gv1Id) throws IOException
|
||||||
{
|
{
|
||||||
Log.i(TAG, "Beginning local migration!", new Throwable());
|
Log.i(TAG, "Beginning local migration! V1 ID: " + gv1Id, new Throwable());
|
||||||
try (Closeable ignored = GroupsV2ProcessingLock.acquireGroupProcessingLock()) {
|
try (Closeable ignored = GroupsV2ProcessingLock.acquireGroupProcessingLock()) {
|
||||||
if (DatabaseFactory.getGroupDatabase(context).groupExists(gv1Id.deriveV2MigrationGroupId())) {
|
if (DatabaseFactory.getGroupDatabase(context).groupExists(gv1Id.deriveV2MigrationGroupId())) {
|
||||||
Log.w(TAG, "Group was already migrated! Could have been waiting for the lock.", new Throwable());
|
Log.w(TAG, "Group was already migrated! Could have been waiting for the lock.", new Throwable());
|
||||||
@@ -159,7 +159,7 @@ public final class GroupsV1MigrationUtil {
|
|||||||
long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipient);
|
long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipient);
|
||||||
|
|
||||||
performLocalMigration(context, gv1Id, threadId, recipient);
|
performLocalMigration(context, gv1Id, threadId, recipient);
|
||||||
Log.i(TAG, "Migration complete!", new Throwable());
|
Log.i(TAG, "Migration complete! (" + gv1Id + ", " + threadId + ", " + recipient.getId() + ")", new Throwable());
|
||||||
} catch (GroupChangeBusyException e) {
|
} catch (GroupChangeBusyException e) {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
@@ -171,6 +171,8 @@ public final class GroupsV1MigrationUtil {
|
|||||||
@NonNull Recipient groupRecipient)
|
@NonNull Recipient groupRecipient)
|
||||||
throws IOException, GroupChangeBusyException
|
throws IOException, GroupChangeBusyException
|
||||||
{
|
{
|
||||||
|
Log.i(TAG, "performLocalMigration(" + gv1Id + ", " + threadId + ", " + groupRecipient.getId());
|
||||||
|
|
||||||
try (Closeable ignored = GroupsV2ProcessingLock.acquireGroupProcessingLock()){
|
try (Closeable ignored = GroupsV2ProcessingLock.acquireGroupProcessingLock()){
|
||||||
DecryptedGroup decryptedGroup;
|
DecryptedGroup decryptedGroup;
|
||||||
try {
|
try {
|
||||||
|
@@ -38,12 +38,10 @@ public class GroupV1MigrationJob extends BaseJob {
|
|||||||
|
|
||||||
public static final String KEY = "GroupV1MigrationJob";
|
public static final String KEY = "GroupV1MigrationJob";
|
||||||
|
|
||||||
public static final long MANUAL_TIMEOUT = TimeUnit.SECONDS.toMillis(20);
|
|
||||||
|
|
||||||
private static final String KEY_RECIPIENT_ID = "recipient_id";
|
private static final String KEY_RECIPIENT_ID = "recipient_id";
|
||||||
|
|
||||||
private static final int ROUTINE_LIMIT = 50;
|
private static final int ROUTINE_LIMIT = 20;
|
||||||
private static final long REFRESH_INTERVAL = TimeUnit.HOURS.toMillis(3);
|
private static final long REFRESH_INTERVAL = TimeUnit.HOURS.toMillis(1);
|
||||||
|
|
||||||
private final RecipientId recipientId;
|
private final RecipientId recipientId;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user