-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11225 from vimeo/log_long_running
Log files being processed for too long
- Loading branch information
Showing
4 changed files
with
70 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Psalm\Internal\Fork; | ||
|
||
use Amp\Serialization\SerializationException; | ||
use Amp\Serialization\Serializer; | ||
use Throwable; | ||
|
||
use function igbinary_serialize; | ||
use function igbinary_unserialize; | ||
use function sprintf; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class IgbinarySerializer implements Serializer | ||
{ | ||
public function serialize(mixed $data): string | ||
{ | ||
try { | ||
$data = igbinary_serialize($data); | ||
if ($data === false) { | ||
throw new SerializationException("Could not serialize data!"); | ||
} | ||
return $data; | ||
} catch (Throwable $exception) { | ||
throw new SerializationException( | ||
sprintf( | ||
'The given data could not be serialized: %s', | ||
$exception->getMessage(), | ||
), | ||
0, | ||
$exception, | ||
); | ||
} | ||
} | ||
|
||
public function unserialize(string $data): mixed | ||
{ | ||
try { | ||
return igbinary_unserialize($data); | ||
} catch (Throwable $exception) { | ||
throw new SerializationException( | ||
'Exception thrown when unserializing data', | ||
0, | ||
$exception, | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters