加权轮询与轮询区别_命令行轮询

加权轮询与轮询区别

In an ideal world, we wouldn't have to poll for anything; we would always have events to trigger other functions.  This isn't an ideal world, however, so it's important to know how to poll in multiple programming languages.  I've covered JavaScript polling (with and without Promises), but what about command line polling?  For example, ensuring MYSQL is up before attempting to perform more operations.

在理想的世界中,我们无需轮询任何东西。 我们总是会有事件触发其他功能。 但是,这不是一个理想的世界,因此了解如何以多种编程语言进行轮询非常重要。 我已经介绍了JavaScript轮询 (带有和不带有Promises ),但是命令行轮询呢? 例如,在尝试执行更多操作之前,请确保MYSQL已启动。

Here's the basic syntax:

基本语法如下:


# while ! (command here); do
while ! mysql -uroot; do
  sleep 1
done


The example above performs the mysql -uroot operation (which will fail until mysqld is up) every second.  Keep in mind the poll operation you run should be as simple as possible, just enough to know that what you want to use is available!

上面的示例mysql -uroot执行一次mysql -uroot操作(直到mysqld启动,该操作将失败)。 请记住,您运行的轮询操作应尽可能简单,足以知道您要使用的功能可用!

翻译自: https://davidwalsh.name/command-line-polling

加权轮询与轮询区别

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值