Skip to content

Commit 712a09d

Browse files
OpenCodeCo Enhancements (#64)
1 parent ff0ac0e commit 712a09d

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

src/Listener/CommandListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public function process(object $event): void
4646
$process->exec($executable, $args);
4747
});
4848
$this->process->start();
49-
sleep(1);
5049
}
5150
}
5251
}

src/MongoClient/Type/UpdateResult.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace Hyperf\GoTask\MongoClient\Type;
1414

15+
use MongoDB\BSON\ObjectId;
1516
use MongoDB\BSON\Unserializable;
1617

1718
class UpdateResult implements Unserializable
@@ -22,7 +23,7 @@ class UpdateResult implements Unserializable
2223

2324
private int $upsertedCount;
2425

25-
private ?string $upsertedId;
26+
private ObjectId|string|null $upsertedId;
2627

2728
public function bsonUnserialize(array $data): void
2829
{
@@ -32,10 +33,7 @@ public function bsonUnserialize(array $data): void
3233
$this->upsertedId = $data['upsertedid'];
3334
}
3435

35-
/**
36-
* @return mixed
37-
*/
38-
public function getUpsertedId(): ?string
36+
public function getUpsertedId(): ObjectId|string|null
3937
{
4038
return $this->upsertedId;
4139
}

src/Relay/CoroutineSocketRelay.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,14 @@ public function connect(): bool
118118

119119
$this->socket = $this->createSocket();
120120
try {
121-
// Port type needs to be int, so we convert null to 0
122-
if ($this->socket->connect($this->address, $this->port ?? 0) === false) {
123-
throw new RelayException(sprintf('%s (%s)', $this->socket->errMsg, $this->socket->errCode));
124-
}
121+
\Hyperf\Support\retry(20, function(): void {
122+
// Port type needs to be int, so we convert null to 0
123+
if ($this->socket->connect($this->address, $this->port ?? 0) === false) {
124+
throw new RelayException(sprintf('%s (%s)', $this->socket->errMsg, $this->socket->errCode));
125+
}
126+
}, 100);
125127
} catch (Exception $e) {
126-
throw new RelayException("unable to establish connection {$this}: {$e->getMessage()}", 0, $e);
128+
throw new RelayException("unable to establish connection (20x) {$this}: {$e->getMessage()}", 0, $e);
127129
}
128130

129131
return true;

src/Wrapper/LoggerWrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(
2121
) {
2222
}
2323

24-
public function log(array $payload): ?mixed
24+
public function log(array $payload): mixed
2525
{
2626
$this->logger->log($payload['level'], $payload['message'], $payload['context']);
2727
return null;

0 commit comments

Comments
 (0)