Make using VOCache optional, off by default

This commit is contained in:
Salad Dais
2021-05-28 21:53:44 +00:00
parent 6df2224be5
commit bf377ae323
4 changed files with 25 additions and 4 deletions

View File

@@ -189,6 +189,7 @@ class ProxyGUI(QtWidgets.QMainWindow):
self.actionProxyRemotelyAccessible.setChecked(
self.settings.value("RemotelyAccessible", False, type=bool))
self.actionProxyRemotelyAccessible.triggered.connect(self._setProxyRemotelyAccessible)
self.actionUseViewerObjectCache.triggered.connect(self._setUseViewerObjectCache)
self._filterMenu = QtWidgets.QMenu()
self._populateFilterMenu()
@@ -373,6 +374,10 @@ class ProxyGUI(QtWidgets.QMainWindow):
msg.setText("Remote accessibility setting changes will take effect on next run")
msg.exec()
def _setUseViewerObjectCache(self, checked: bool):
self.settings.setValue("UseViewerObjectCache", checked)
self.sessionManager.use_viewer_object_cache = checked
def _manageAddons(self):
dialog = AddonDialog(self)
dialog.exec_()
@@ -809,6 +814,8 @@ def gui_main():
signal.signal(signal.SIGINT, lambda *args: QtWidgets.QApplication.quit())
window.show()
remote_access = window.settings.value("RemotelyAccessible", False, type=bool)
use_vocache = window.settings.value("UseViewerObjectCache", False, type=bool)
window.sessionManager.use_viewer_object_cache = use_vocache
http_host = None
if remote_access:
http_host = "0.0.0.0"

View File

@@ -262,6 +262,7 @@
<addaction name="actionManageFilters"/>
<addaction name="separator"/>
<addaction name="actionProxyRemotelyAccessible"/>
<addaction name="actionUseViewerObjectCache"/>
</widget>
<addaction name="menuFile"/>
</widget>
@@ -299,6 +300,17 @@
<string>Make the proxy accessible from other devices on the network</string>
</property>
</action>
<action name="actionUseViewerObjectCache">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Use Viewer Object Cache</string>
</property>
<property name="toolTip">
<string>Can help make the proxy aware of certain objects, but can cause slowdowns</string>
</property>
</action>
</widget>
<resources/>
<connections/>

View File

@@ -124,10 +124,11 @@ class InterceptingLLUDPProxyProtocol(BaseLLUDPProxyProtocol):
AddonManager.handle_region_changed(self.session, region)
if message.name == "RegionHandshake":
region.cache_id = message["RegionInfo"]["CacheID"]
try:
region.objects.load_cache()
except:
LOG.exception("Failed to load region cache, skipping")
if self.session_manager.use_viewer_object_cache:
try:
region.objects.load_cache()
except:
LOG.exception("Failed to load region cache, skipping")
try:
region.message_handler.handle(message)

View File

@@ -154,6 +154,7 @@ class SessionManager:
self.message_logger: Optional[BaseMessageLogger] = None
self.addon_ctx: Dict[str, Any] = {}
self.name_cache = NameCache()
self.use_viewer_object_cache: bool = False
def create_session(self, login_data) -> Session:
session = Session.from_login_data(login_data, self)