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