-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathConfig.php
More file actions
164 lines (145 loc) · 4.29 KB
/
Config.php
File metadata and controls
164 lines (145 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
declare(strict_types=1);
namespace Phphleb\Webrotor;
use Psr\Log\LogLevel;
/**
* @author Foma Tuturov <fomiash@yandex.ru>
*
* Configuration class for overriding all or some default settings.
* Application example:
*
* ```php
* $config = new Config();
* $config->workerLifetimeSec = 60;
*
* $server = new WebRotor($config);
* ```
*/
final class Config
{
/**
* Debug mode status.
* Must be disabled on a public server.
*
* @var bool
*/
public $debug = false;
/**
* Number of running workers.
* Must match the actual number of workers,
* for example, those launched via cron.
* If it is 0, then it works in normal
* non-synchronous mode.
*
* @var non-negative-int
*/
public $workerNum = 1;
/**
* The value must match the frequency of the worker launch.
* Recommended value is 60 seconds.
*
* @var positive-int
*/
public $workerLifetimeSec = 60;
/**
* Specifies the number of seconds after which the worker will shut down
* if no requests have been received during this period.
* If all workers go idle ahead of the scheduled restart, the application
* will operate without asynchronous processing until the next worker run.
* If the value is set to 0, no early shutdown will occur.
*
* @var non-negative-int
*/
public $idleTimeoutSec = 0;
/**
* Specifies the full path to the directory
* for storing dynamic script data,
* if it differs from the default.
* (!) Should not be in a public directory.
* You need write permissions for the web server
* in this directory.
*
* @var null|string
*/
public $runtimeDirectory = null;
/**
* Full path to the directory with web server logs.
* Only for default file logs.
*
* @var null|string
*/
public $logDirectory = null;
/**
* Logging level according to PSR-3
*
* @var string
*/
public $logLevel = LogLevel::ERROR;
/**
* Maximum time to wait for a response from a worker in seconds.
* After this, the pending request will be processed as usual.
* The lower the value, the more likely it is that
* the request data may be processed twice.
* If 0 then it will wait for a response until a timeout error occurs.
*
* @var int
*/
public $workerResponseTimeSec = 5;
/**
* Sets the day before which logs should be deleted.
* If 0 then there will be no log rotation.
* Only for default file logs.
*
* @var int
*/
public $logRotationPerDay = 7;
/**
* The time zone value for the web server.
* If an empty string is passed,
* the value will be obtained automatically.
*
* @var string
*/
public $timeZone = 'UTC';
/**
* The lifetime of the temporary worker in seconds.
* If 0 is specified, then the value is equal to the main worker lifetime.
*
* @var int
*/
public $temporaryWorkerLifetimeSec = 60;
/**
* The delay for the worker while waiting for requests in microseconds.
* The delay until the next search for unprocessed requests by the worker
* if they were missing depends on this value.
* If 0 is specified, the worker will not pause while waiting.
*
* @var int
*/
public $workerRequestDelayMicroSec = 100;
/**
* The delay for the process while waiting for response in microseconds.
* This value determines the interval at which the worker’s response will be checked.
* If 0 is specified, the process will not pause while waiting.
*
* @var int
*/
public $responseDelayWaitMicroSec = 10;
/**
* To create temporary workers, you need to run them with the correct interpreter.
* This path will be searched and {version}
* will be replaced with the current version.
* If the line is empty, temporary workers will not be able
* to be created and will be disabled.
*
* @var string
*/
public $interpreterPathPattern = '/usr/local/bin/php{version}';
/**
* When sending new code to the server, simply increment this value
* by one and the old running workers will not process the new code.
*
* @var int
*/
public $codeVersion = 1;
}