Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个新闻应用程序,它每小时通过 cron 获取 rss 提要。由于它必须获取的文件 (URL) 列表有 100 个,因此它会卡住。是否可以编写一个有条件的 cron 脚本,例如从 100 的列表中一次仅获取 10 个并运行
您只需在数据库中添加时间戳字段即可。每次提取都会更新。因此,当您通过 cron 获取 url 时,它会更新最后一次获取时间。然后您可以进行查询,根据 DESC 顺序和限制 10 的最后获取时间获取 url。
所以只提取了 10 个很久没有提取的 url。我认为这将解决您的问题。