EDIT: Please refer the post here for latest NodeJS & PHP Wait custom module.
Hi.
Have created a simple SLEEP custom module for PHP. This was required in my project to delay calling of third-party API in a loop to avoid 429 Too many requests
error. It takes 1 input for time in milliseconds for which the action should sleep/wait.
custom.hjson
{
type: 'custom_waitsleep',
module : 'custom',
action : 'waitsleep',
groupTitle : 'Core Actions',
groupIcon : 'fas fa-lg fa-cube comp-flows',
title : 'Sleep @@var(actionValue)@@',
icon : 'fas fa-lg fa-pause comp-general',
dataPickObject: false,
properties : [
{
group: 'Properties',
variables: [
{ name: 'actionName', optionName: 'name', title: 'Name',
type: 'text', required: true, defaultValue: ''},
{ name: 'actionValue', optionName: 'value', title: 'Time',
type: 'text', defaultValue: '', help: 'in miliseconds'}
]
}
]
}
custom.php
<?php
namespace modules;
use \lib\core\Module;
class custom extends Module
{
public function waitsleep($options, $name) {
//Sleep time in ms
usleep($this->app->parseObject($options->value) * 1000);
return true;
}
}
?>
Please read the documentation for more details on how to use this.
Community Page
Last updated:
Last updated: