Skip to content

Commit f803acb

Browse files
committed
Rename methods
1 parent 562311a commit f803acb

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ $task = JobBuilder::fromService('service_foo', ['bar', 'baz'])
2323
->withServiceMethod('qux')
2424
->withConstantBackoff()
2525
->withMaxRetries(3)
26-
->withRecurrenceInterval(60)
27-
->withTimeToExecute(5)
28-
->withTimeToRun(300)
26+
->withRecurrenceIntervalSeconds(600)
27+
->withTimeToLiveSeconds(300)
28+
->withTimeToRunSeconds(180)
2929
->withPriority(4)
30-
->withDelay(60)
30+
->withDelaySeconds(60)
3131
->withTube('foobar')
32-
->putTo($queue);
32+
->build();
3333
```
3434

3535
```php

src/JobBuilder.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ public function withDisabledRetries() : self
9999
return $new;
100100
}
101101

102-
public function withRecurrenceInterval(int $interval) : self
102+
public function withRecurrenceIntervalSeconds(int $intervalSeconds) : self
103103
{
104104
$new = clone $this;
105-
$new->jobOptions[JobOptions::RECURRENCE] = $interval;
105+
$new->jobOptions[JobOptions::RECURRENCE] = $intervalSeconds;
106106

107107
return $new;
108108
}
@@ -115,18 +115,18 @@ public function withDisabledRecurrence() : self
115115
return $new;
116116
}
117117

118-
public function withTimeToRun(int $ttl) : self
118+
public function withTimeToLiveSeconds(int $ttlSeconds) : self
119119
{
120120
$new = clone $this;
121-
$new->taskOptions[Options::TTL] = $ttl;
121+
$new->taskOptions[Options::TTL] = $ttlSeconds;
122122

123123
return $new;
124124
}
125125

126-
public function withTimeToExecute(int $ttr) : self
126+
public function withTimeToRunSeconds(int $ttrSeconds) : self
127127
{
128128
$new = clone $this;
129-
$new->taskOptions[Options::TTR] = $ttr;
129+
$new->taskOptions[Options::TTR] = $ttrSeconds;
130130

131131
return $new;
132132
}
@@ -139,10 +139,10 @@ public function withPriority(int $priority) : self
139139
return $new;
140140
}
141141

142-
public function withDelay(int $delay) : self
142+
public function withDelaySeconds(int $delaySeconds) : self
143143
{
144144
$new = clone $this;
145-
$new->taskOptions[Options::DELAY] = $delay;
145+
$new->taskOptions[Options::DELAY] = $delaySeconds;
146146

147147
return $new;
148148
}

tests/JobBuilderTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ public function testBuildFull() : void
3333
->withServiceMethod('qux')
3434
->withConstantBackoff()
3535
->withMaxRetries(3)
36-
->withRecurrenceInterval(60)
37-
->withTimeToExecute(5)
38-
->withTimeToRun(300)
36+
->withRecurrenceIntervalSeconds(600)
37+
->withTimeToLiveSeconds(300)
38+
->withTimeToRunSeconds(180)
3939
->withPriority(4)
40-
->withDelay(60)
40+
->withDelaySeconds(60)
4141
->withTube('foobar')
4242
->build();
4343

@@ -49,12 +49,12 @@ public function testBuildFull() : void
4949
],
5050
'retry_strategy' => 'constant',
5151
'retry_limit' => 3,
52-
'recurrence' => 60,
52+
'recurrence' => 600,
5353
], $data);
5454

5555
self::assertSame([
56-
Options::TTR => 5,
5756
Options::TTL => 300,
57+
Options::TTR => 180,
5858
Options::PRI => 4,
5959
Options::DELAY => 60,
6060
Options::UTUBE => 'foobar',

0 commit comments

Comments
 (0)