本帖最后由 523066680 于 2021-4-18 10:35 编辑
把以前的爬虫(固定延迟,抓取同一个页面)放到旧的小米手机Termux上面跑,一天后发现抓的页面时间点断断续续。
于是另写一个固定延时显示时间的脚本做测试 | | | use Date::Format; | | STDOUT->autoflush(1); | | while (1) | | { | | printf "%s\n", time2str( "%H:%M:%S", time() ); | | sleep 60; | | }COPY |
进程切换后台后执行,数小时后查看时间间隔果然不一致,解决方法:
https://wiki.termux.com/wiki/Termux-wake-locktermux-wake-unlockCOPY termux-wake-lock and termux-wake-unlock can be used to trigger a wakelock which causes Android not to go into deep sleep. |