mirror of https://github.com/zlatinb/muwire
add an option to disable throttling of the loading of shared files on startup
parent
1e7e30dee2
commit
8356a92aa3
|
@ -31,6 +31,7 @@ class MuWireSettings {
|
|||
boolean shareHiddenFiles
|
||||
volatile int hashingCores
|
||||
Set<String> ignoredFileTypes
|
||||
boolean throttleLoadingFiles
|
||||
boolean searchComments
|
||||
boolean searchCollections
|
||||
boolean browseFiles
|
||||
|
@ -101,6 +102,7 @@ class MuWireSettings {
|
|||
shareDownloadedFiles = Boolean.parseBoolean(props.getProperty("shareDownloadedFiles","true"))
|
||||
shareHiddenFiles = Boolean.parseBoolean(props.getProperty("shareHiddenFiles","false"))
|
||||
hashingCores = Integer.parseInt(props.getProperty("hashingCores", String.valueOf(numHashingCores())))
|
||||
throttleLoadingFiles = Boolean.parseBoolean(props.getProperty("throttleLoadingFiles", "true"))
|
||||
downloadSequentialRatio = Float.valueOf(props.getProperty("downloadSequentialRatio","0.8"))
|
||||
hostClearInterval = Integer.valueOf(props.getProperty("hostClearInterval","15"))
|
||||
hostHopelessInterval = Integer.valueOf(props.getProperty("hostHopelessInterval", "60"))
|
||||
|
@ -194,6 +196,7 @@ class MuWireSettings {
|
|||
props.setProperty("shareDownloadedFiles", String.valueOf(shareDownloadedFiles))
|
||||
props.setProperty("shareHiddenFiles", String.valueOf(shareHiddenFiles))
|
||||
props.setProperty("hashingCores", String.valueOf(hashingCores))
|
||||
props.setProperty("throttleLoadingFiles", String.valueOf(throttleLoadingFiles))
|
||||
props.setProperty("downloadSequentialRatio", String.valueOf(downloadSequentialRatio))
|
||||
props.setProperty("hostClearInterval", String.valueOf(hostClearInterval))
|
||||
props.setProperty("hostHopelessInterval", String.valueOf(hostHopelessInterval))
|
||||
|
|
|
@ -141,7 +141,7 @@ class PersisterFolderService extends BasePersisterService {
|
|||
stream = stream.filter({
|
||||
it.getFileName().toString().endsWith(".json")
|
||||
})
|
||||
if (core.muOptions.plugin)
|
||||
if (core.muOptions.plugin || !core.muOptions.throttleLoadingFiles)
|
||||
stream = stream.parallel()
|
||||
stream.forEach({
|
||||
log.fine("processing path $it")
|
||||
|
@ -158,7 +158,7 @@ class PersisterFolderService extends BasePersisterService {
|
|||
|
||||
log.fine("loaded file $event.loadedFile.file")
|
||||
listener.publish event
|
||||
if (!core.muOptions.plugin) {
|
||||
if (!core.muOptions.plugin && core.muOptions.throttleLoadingFiles) {
|
||||
loaded++
|
||||
if (loaded % 10 == 0)
|
||||
Thread.sleep(20)
|
||||
|
|
|
@ -113,6 +113,10 @@ class OptionsController {
|
|||
settings.ignoredFileTypes.clear()
|
||||
text.split(",").each {settings.ignoredFileTypes.add(it)}
|
||||
|
||||
boolean throttleLoadingFiles = view.throttleLoadingFilesCheckbox.model.isSelected()
|
||||
model.throttleLoadingFiles = throttleLoadingFiles
|
||||
settings.throttleLoadingFiles = throttleLoadingFiles
|
||||
|
||||
boolean browseFiles = view.browseFilesCheckbox.model.isSelected()
|
||||
model.browseFiles = browseFiles
|
||||
settings.browseFiles = browseFiles
|
||||
|
|
|
@ -298,6 +298,7 @@ OPTIONS_SHARE_DOWNLOADED_FILES=Share downloaded files
|
|||
OPTIONS_SHARE_HIDDEN_FILES=Share hidden files
|
||||
OPTIONS_HASHING_CORES=CPU Cores to use when hashing
|
||||
OPTIONS_IGNORED_FILE_TYPES=File types to not share
|
||||
OPTIONS_THROTTLE_LOADING_FILES=Throttle loading of shared files on startup
|
||||
OPTIONS_UPDATE_SETTINGS=Update Settings
|
||||
OPTIONS_CHECK_FOR_UPDATES=Check for updates every (hours)
|
||||
OPTIONS_DOWNLOAD_UPDATES=Download updates automatically
|
||||
|
|
|
@ -18,6 +18,7 @@ class OptionsModel {
|
|||
@Observable boolean shareDownloadedFiles
|
||||
@Observable boolean shareHiddenFiles
|
||||
@Observable int hashingCores
|
||||
@Observable boolean throttleLoadingFiles
|
||||
@Observable String ignoredFileTypes
|
||||
@Observable String downloadLocation
|
||||
@Observable String incompleteLocation
|
||||
|
@ -98,6 +99,7 @@ class OptionsModel {
|
|||
shareDownloadedFiles = settings.shareDownloadedFiles
|
||||
shareHiddenFiles = settings.shareHiddenFiles
|
||||
hashingCores = settings.hashingCores
|
||||
throttleLoadingFiles = settings.throttleLoadingFiles
|
||||
ignoredFileTypes = settings.ignoredFileTypes.join(",")
|
||||
downloadLocation = settings.downloadLocation.getAbsolutePath()
|
||||
incompleteLocation = settings.incompleteLocation.getAbsolutePath()
|
||||
|
|
|
@ -50,6 +50,7 @@ class OptionsView {
|
|||
def shareDownloadedCheckbox
|
||||
def shareHiddenCheckbox
|
||||
def hashingCoresTextField
|
||||
def throttleLoadingFilesCheckbox
|
||||
def ignoredFileTypesTextField
|
||||
def searchCommentsCheckbox
|
||||
def searchCollectionsCheckbox
|
||||
|
@ -182,6 +183,10 @@ class OptionsView {
|
|||
label(text : trans("OPTIONS_IGNORED_FILE_TYPES"), constraints : gbc(gridx: 0, gridy: 3, anchor: GridBagConstraints.LINE_START, weightx : 100))
|
||||
ignoredFileTypesTextField = textField(text : bind {model.ignoredFileTypes}, columns: 25,
|
||||
constraints: gbc(gridx: 1, gridy: 3, anchor: GridBagConstraints.LINE_END, fill: GridBagConstraints.HORIZONTAL))
|
||||
|
||||
label(text : trans("OPTIONS_THROTTLE_LOADING_FILES"), constraints: gbc(gridx: 0, gridy: 4, anchor: GridBagConstraints.LINE_START, weightx: 100))
|
||||
throttleLoadingFilesCheckbox = checkBox(selected: bind{model.throttleLoadingFiles}, constraints: gbc(gridx: 1, gridy: 4, anchor: GridBagConstraints.LINE_END,
|
||||
weightx: 0))
|
||||
}
|
||||
|
||||
if (!model.disableUpdates) {
|
||||
|
|
Loading…
Reference in New Issue