@@ -49,9 +49,34 @@ class Resque_Worker
49
49
*/
50
50
private $ child = null ;
51
51
52
- public function __construct ()
52
+ /**
53
+ * Instantiate a new worker, given a list of queues that it should be working
54
+ * on. The list of queues should be supplied in the priority that they should
55
+ * be checked for jobs (first come, first served)
56
+ *
57
+ * Passing a single '*' allows the worker to work on all queues in alphabetical
58
+ * order. You can easily add new queues dynamically and have them worked on using
59
+ * this method.
60
+ *
61
+ * @param string|array $queues String with a single queue name, array with multiple.
62
+ */
63
+ public function __construct ($ queues )
53
64
{
54
65
$ this ->logger = new Resque_Log ();
66
+
67
+ if (!is_array ($ queues )) {
68
+ $ queues = array ($ queues );
69
+ }
70
+
71
+ $ this ->queues = $ queues ;
72
+ if (function_exists ('gethostname ' )) {
73
+ $ hostname = gethostname ();
74
+ }
75
+ else {
76
+ $ hostname = php_uname ('n ' );
77
+ }
78
+ $ this ->hostname = $ hostname ;
79
+ $ this ->id = $ this ->hostname . ': ' .getmypid () . ': ' . implode (', ' , $ this ->queues );
55
80
}
56
81
57
82
/**
@@ -112,34 +137,6 @@ public function setId($workerId)
112
137
$ this ->id = $ workerId ;
113
138
}
114
139
115
- /**
116
- * Instantiate a new worker, given a list of queues that it should be working
117
- * on. The list of queues should be supplied in the priority that they should
118
- * be checked for jobs (first come, first served)
119
- *
120
- * Passing a single '*' allows the worker to work on all queues in alphabetical
121
- * order. You can easily add new queues dynamically and have them worked on using
122
- * this method.
123
- *
124
- * @param string|array $queues String with a single queue name, array with multiple.
125
- */
126
- public function __construct ($ queues )
127
- {
128
- if (!is_array ($ queues )) {
129
- $ queues = array ($ queues );
130
- }
131
-
132
- $ this ->queues = $ queues ;
133
- if (function_exists ('gethostname ' )) {
134
- $ hostname = gethostname ();
135
- }
136
- else {
137
- $ hostname = php_uname ('n ' );
138
- }
139
- $ this ->hostname = $ hostname ;
140
- $ this ->id = $ this ->hostname . ': ' .getmypid () . ': ' . implode (', ' , $ this ->queues );
141
- }
142
-
143
140
/**
144
141
* The primary loop for a worker which when called on an instance starts
145
142
* the worker's life cycle.
0 commit comments