Skip to content

Intermittent connection puts jobs into default tube #38

@chrisminett

Description

@chrisminett

A Pool with an intermittent connection to a server can put jobs into the default tube, even though calling useTube() followed immediately by put().


The useTube() in Pool

beanstalk/src/Pool.php

Lines 88 to 96 in 887a53e

public function useTube(string $tube): void
{
foreach ($this->getAvailableConnections() as $connection) {
try {
$connection->useTube($tube);
} catch (RuntimeException $e) {
// ignore connections not responding
}
}

ignores errors from a connection, so if the server which failed to set the correct tube is then chosen by the Pool for the put()

beanstalk/src/Pool.php

Lines 101 to 113 in 887a53e

public function put(
string $data,
int $priority = self::DEFAULT_PRIORITY,
int $delay = self::DEFAULT_DELAY,
int $ttr = self::DEFAULT_TTR
): string {
return $this->sendToOne(
function (ConnectionInterface $connection, string $key) use ($data, $priority, $delay, $ttr): string {
$jobId = $connection->put($data, $priority, $delay, $ttr);
return $this->combineId($key, $jobId);
}
);
}

the job is put in the default queue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions