@@ -49,6 +49,36 @@ class Resque_Worker
49
49
*/
50
50
private $ child = null ;
51
51
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 )
64
+ {
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 );
80
+ }
81
+
52
82
/**
53
83
* Return all workers known to Resque as instantiated instances.
54
84
* @return array
@@ -107,34 +137,6 @@ public function setId($workerId)
107
137
$ this ->id = $ workerId ;
108
138
}
109
139
110
- /**
111
- * Instantiate a new worker, given a list of queues that it should be working
112
- * on. The list of queues should be supplied in the priority that they should
113
- * be checked for jobs (first come, first served)
114
- *
115
- * Passing a single '*' allows the worker to work on all queues in alphabetical
116
- * order. You can easily add new queues dynamically and have them worked on using
117
- * this method.
118
- *
119
- * @param string|array $queues String with a single queue name, array with multiple.
120
- */
121
- public function __construct ($ queues )
122
- {
123
- if (!is_array ($ queues )) {
124
- $ queues = array ($ queues );
125
- }
126
-
127
- $ this ->queues = $ queues ;
128
- if (function_exists ('gethostname ' )) {
129
- $ hostname = gethostname ();
130
- }
131
- else {
132
- $ hostname = php_uname ('n ' );
133
- }
134
- $ this ->hostname = $ hostname ;
135
- $ this ->id = $ this ->hostname . ': ' .getmypid () . ': ' . implode (', ' , $ this ->queues );
136
- }
137
-
138
140
/**
139
141
* The primary loop for a worker which when called on an instance starts
140
142
* the worker's life cycle.
0 commit comments