[英]How to manually invoke SpellCheck avoiding Browser timeout
I'm trying to update the SpellChecker in my local MoinMoin installation according to this documentation page: https://moinmo.in/HelpOnSpellCheck . 我正在尝试根据以下文档页面更新本地MoinMoin安装中的SpellChecker: https : //moinmo.in/HelpOnSpellCheck 。
I followed the steps, got a new dictionary file and sym-linked it into data/dict
directory in the MoinMoin installation path. 我按照步骤进行操作,获得了一个新的词典文件,并将其符号链接到MoinMoin安装路径中的
data/dict
目录。 I then deleted /data/cache/spellchecker.dict
, which should be rebuilt upon invoking the SpellCheck action. 然后,我删除了
/data/cache/spellchecker.dict
,应在调用/data/cache/spellchecker.dict
时将其重建。 If I visit my Wiki and use SpellCheck, the browser times out upon building the SpellCheck database, as expected according to the link above. 如果我访问我的Wiki并使用SpellCheck,则根据上面的链接,浏览器在构建SpellCheck数据库时会超时。
In the documentation it says: "If your browser or the webserver timeouts before the file is completely built, one solution is to telnet into your webserver, and manually request the page." 在文档中说:“如果您的浏览器或Web服务器在文件完全构建之前超时,则一种解决方案是telnet到Web服务器,然后手动请求页面。” This is what I'm trying to do.
这就是我想要做的。 Unfortunately the request does not seem to invoke the database creation and quickly returns the requested page.
不幸的是,该请求似乎并未调用数据库创建,而是迅速返回了所请求的页面。
Here is how I requested the page (I'm hosting it locally over port 8085): 这是我请求页面的方式(我通过端口8085在本地托管它):
telnet 192.168.1.199 8085
Trying 192.168.1.199...
Connected to 192.168.1.199.
Escape character is '^]'.
HEAD /wiki/FrontPage?action=SpellCheck HTTP/1.1
Host: 192.168.1.199
HTTP/1.1 200 OK
...
I would expect that the request invokes the database creation, as it does in a web browser. 我希望该请求像在Web浏览器中一样调用数据库创建。 This should take a few minutes and I should afterwards be able to find the created database in
/data/cache/
. 这需要几分钟,然后我应该能够在
/data/cache/
找到创建的数据库。 Unfortunately this does not happen. 不幸的是,这没有发生。
If anyone else is interested, here is how I ended up solving the problem: I narrowed the possible timeouts down to either the webserver (nginx) or uwsgi, hence I did the following changes to the config-files: 如果其他人感兴趣,这就是我最终解决问题的方法:我将可能的超时范围缩小到了Web服务器(nginx)或uwsgi,因此对配置文件进行了以下更改:
In /etc/moin/uwsgi.ini
: 在
/etc/moin/uwsgi.ini
:
harakiri 9999
In /etc/nginx/nginx.conf
: 在
/etc/nginx/nginx.conf
:
uwsgi_read_timeout 9999
uwsgi_send_timeout 9999
I then used the python package requests
to send the get-request to the server: 然后,我使用python软件包
requests
将get-request发送到服务器:
import requests
r = requests.get('http://192.168.1.199:8085/wiki/FrontPage',
params={'action' : 'SpellCheck'}, timeout=9999)
This ran for about 2-3 minutes. 运行了大约2-3分钟。 Afterwards, the word count shown when performing a spelling check was 629182, reflecting the number of words present in my dictionary.
之后,执行拼写检查时显示的单词数为629182,反映了我的词典中存在的单词数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.