Fix pre+pro transfers progress bar
Max wait transfers 1000 -> 10000
Pro workers -> 100
This commit is contained in:
tonikelope 2023-10-27 16:14:24 +02:00
parent c0bb5f6d58
commit cd6b453466
5 changed files with 36 additions and 57 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId> <groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId> <artifactId>MegaBasterd</artifactId>
<version>8.9</version> <version>8.10</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<repositories> <repositories>
<repository> <repository>

View File

@ -70,7 +70,7 @@ import javax.swing.UIManager;
*/ */
public final class MainPanel { public final class MainPanel {
public static final String VERSION = "8.9"; public static final String VERSION = "8.10";
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
public static final int THROTTLE_SLICE_SIZE = 16 * 1024; public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024; public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;

View File

@ -221,18 +221,19 @@ public final class MainPanelView extends javax.swing.JFrame {
if (dialog.isUpload() && dialog.getFiles().size() > 0) { if (dialog.isUpload() && dialog.getFiles().size() > 0) {
MiscTools.GUIRun(() -> {
upload_status_bar.setIndeterminate(true);
upload_status_bar.setMaximum(getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().size() + dialog.getFiles().size());
upload_status_bar.setVisible(true);
});
getMain_panel().resumeUploads(); getMain_panel().resumeUploads();
getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().addAll(dialog.getFiles()); getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().addAll(dialog.getFiles());
getMain_panel().getUpload_manager().secureNotify(); getMain_panel().getUpload_manager().secureNotify();
MiscTools.GUIRun(() -> {
upload_status_bar.setIndeterminate(true);
upload_status_bar.setValue(upload_status_bar.getMinimum());
upload_status_bar.setMaximum(getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().size() + getMain_panel().getUpload_manager().getTransference_preprocess_queue().size() + getMain_panel().getUpload_manager().getTransference_provision_queue().size());
upload_status_bar.setVisible(true);
});
final String mega_account = (String) dialog.getAccount_combobox().getSelectedItem(); final String mega_account = (String) dialog.getAccount_combobox().getSelectedItem();
final String base_path = dialog.getBase_path(); final String base_path = dialog.getBase_path();
@ -376,25 +377,12 @@ public final class MainPanelView extends javax.swing.JFrame {
LOG.log(SEVERE, null, ex); LOG.log(SEVERE, null, ex);
} }
MiscTools.GUIRun(() -> {
upload_status_bar.setIndeterminate(false);
upload_status_bar.setValue(upload_status_bar.getValue() + 1);
});
} }
} catch (Exception ex) { } catch (Exception ex) {
LOG.log(SEVERE, null, ex); LOG.log(SEVERE, null, ex);
} }
if (getMain_panel().getUpload_manager().getTransference_preprocess_queue().isEmpty()) {
MiscTools.GUIRun(() -> {
upload_status_bar.setValue(upload_status_bar.getMinimum());
upload_status_bar.setVisible(false);
});
}
}; };
getMain_panel().getUpload_manager().getTransference_preprocess_queue().add(run); getMain_panel().getUpload_manager().getTransference_preprocess_queue().add(run);
@ -1100,11 +1088,6 @@ public final class MainPanelView extends javax.swing.JFrame {
}); });
if (!urls.isEmpty()) { if (!urls.isEmpty()) {
MiscTools.GUIRun(() -> {
download_status_bar.setIndeterminate(true);
download_status_bar.setMaximum(getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().size() + urls.size());
download_status_bar.setVisible(true);
});
Set<String> folder_file_links = new HashSet(findAllRegex("(?:https?|mega)://[^\r\n]+#F\\*[^\r\n!]*?![^\r\n!]+![^\\?\r\n/]+", link_data, 0)); Set<String> folder_file_links = new HashSet(findAllRegex("(?:https?|mega)://[^\r\n]+#F\\*[^\r\n!]*?![^\r\n!]+![^\\?\r\n/]+", link_data, 0));
@ -1112,6 +1095,13 @@ public final class MainPanelView extends javax.swing.JFrame {
getMain_panel().getDownload_manager().secureNotify(); getMain_panel().getDownload_manager().secureNotify();
MiscTools.GUIRun(() -> {
download_status_bar.setIndeterminate(true);
download_status_bar.setValue(download_status_bar.getMinimum());
download_status_bar.setMaximum(getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().size() + getMain_panel().getDownload_manager().getTransference_preprocess_queue().size() + getMain_panel().getDownload_manager().getTransference_provision_queue().size());
download_status_bar.setVisible(true);
});
if (!folder_file_links.isEmpty()) { if (!folder_file_links.isEmpty()) {
ArrayList<String> nlinks = ma.GENERATE_N_LINKS(folder_file_links); ArrayList<String> nlinks = ma.GENERATE_N_LINKS(folder_file_links);
@ -1244,19 +1234,8 @@ public final class MainPanelView extends javax.swing.JFrame {
Logger.getLogger(MainPanelView.class.getName()).log(Level.SEVERE, ex.getMessage()); Logger.getLogger(MainPanelView.class.getName()).log(Level.SEVERE, ex.getMessage());
} }
MiscTools.GUIRun(() -> {
download_status_bar.setIndeterminate(false);
download_status_bar.setValue(upload_status_bar.getValue() + 1);
});
} }
if (getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().isEmpty()) {
MiscTools.GUIRun(() -> {
download_status_bar.setValue(download_status_bar.getMinimum());
download_status_bar.setVisible(false);
});
}
} else { } else {
MiscTools.GUIRun(() -> { MiscTools.GUIRun(() -> {
new_download_menu.setEnabled(true); new_download_menu.setEnabled(true);

View File

@ -30,8 +30,8 @@ import javax.swing.JPanel;
*/ */
abstract public class TransferenceManager implements Runnable, SecureSingleThreadNotifiable { abstract public class TransferenceManager implements Runnable, SecureSingleThreadNotifiable {
public static final int MAX_WAIT_QUEUE = 1000; public static final int MAX_WAIT_QUEUE = 10000;
public static final int MAX_PROVISION_WORKERS = 25; public static final int MAX_PROVISION_WORKERS = 50;
private static final Logger LOG = Logger.getLogger(TransferenceManager.class.getName()); private static final Logger LOG = Logger.getLogger(TransferenceManager.class.getName());
protected final ConcurrentLinkedQueue<Object> _transference_preprocess_global_queue; protected final ConcurrentLinkedQueue<Object> _transference_preprocess_global_queue;
@ -680,24 +680,6 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
_status.setText(_genStatus()); _status.setText(_genStatus());
/*if (_transference_preprocess_queue.isEmpty() && !_transference_provision_queue.isEmpty()) {
if (this instanceof DownloadManager) {
this._main_panel.getView().getDownload_status_bar().setIndeterminate(true);
this._main_panel.getView().getDownload_status_bar().setVisible(true);
} else {
this._main_panel.getView().getUpload_status_bar().setIndeterminate(true);
this._main_panel.getView().getUpload_status_bar().setVisible(true);
}
} else if (_transference_preprocess_queue.isEmpty()) {
if (this instanceof DownloadManager) {
this._main_panel.getView().getDownload_status_bar().setIndeterminate(false);
this._main_panel.getView().getDownload_status_bar().setVisible(false);
} else {
this._main_panel.getView().getUpload_status_bar().setIndeterminate(false);
this._main_panel.getView().getUpload_status_bar().setVisible(false);
}
}*/
_main_panel.getView().getUnfreeze_transferences_button().setVisible(_main_panel.getDownload_manager().hasFrozenTransferences() || _main_panel.getUpload_manager().hasFrozenTransferences()); _main_panel.getView().getUnfreeze_transferences_button().setVisible(_main_panel.getDownload_manager().hasFrozenTransferences() || _main_panel.getUpload_manager().hasFrozenTransferences());
_main_panel.getView().revalidate(); _main_panel.getView().revalidate();
@ -832,6 +814,24 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
try { try {
bounded_executor.submitTask(() -> { bounded_executor.submitTask(() -> {
provision(transference); provision(transference);
if (this instanceof DownloadManager) {
MiscTools.GUIRun(() -> {
_main_panel.getView().getDownload_status_bar().setIndeterminate(false);
_main_panel.getView().getDownload_status_bar().setValue(_main_panel.getView().getDownload_status_bar().getValue() + 1);
_main_panel.getView().getDownload_status_bar().setVisible((_main_panel.getView().getDownload_status_bar().getValue() < _main_panel.getView().getDownload_status_bar().getMaximum()));
});
} else {
MiscTools.GUIRun(() -> {
_main_panel.getView().getUpload_status_bar().setIndeterminate(false);
_main_panel.getView().getUpload_status_bar().setValue(_main_panel.getView().getUpload_status_bar().getValue() + 1);
_main_panel.getView().getUpload_status_bar().setVisible((_main_panel.getView().getUpload_status_bar().getValue() < _main_panel.getView().getUpload_status_bar().getMaximum()));
});
}
}); });
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
Logger.getLogger(TransferenceManager.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(TransferenceManager.class.getName()).log(Level.SEVERE, null, ex);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

After

Width:  |  Height:  |  Size: 207 KiB