Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix in connection handling #176

Merged
merged 13 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
php-version: [8.1, 8.2]
dependencies: ["", "--prefer-lowest --prefer-stable"]

env:
COMPOSER_CACHE_DIR: ${{ github.workspace }}/.composer/cache
PHP_CS_FIXER_CACHE_DIR: ${{ github.workspace }}/.php-cs-fixer
LOCAL_CACHE_DIR: ${{ github.workspace }}/.local
GITHUB_REF: ${{ github.ref }}
GITHUB_ACTIONS: true
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: ${{ matrix.php-version == '8.2' && matrix.dependencies == '' }}
extensions: pcov
ini-values: |
memory_limit=-1
tools: composer:v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
${{ env.COMPOSER_CACHE_DIR }}
${{ env.PHP_CS_FIXER_CACHE_DIR }}
${{ env.LOCAL_CACHE_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install EventStore
run: |
echo downloading EventStore 5.0.10
wget https://github.com/EventStore/Downloads/raw/master/ubuntu/EventStore-OSS-Linux-Ubuntu-16.04-v5.0.10.tar.gz
echo extracting event-store
tar xf EventStore-OSS-Linux-Ubuntu-16.04-v5.0.10.tar.gz
cd EventStore-OSS-Linux-Ubuntu-16.04-v5.0.10
echo starting event-store
./run-node.sh --run-projections=all --mem-db --ext-tcp-heartbeat-interval 5000 --ext-tcp-heartbeat-timeout 1500 --ext-http-prefixes="http://*:2113/" --add-interface-prefixes=false > /dev/null &
cd ..
mkdir -p ${{ env.PHP_CS_FIXER_CACHE_DIR }}

- name: Disable Xdebug
if: ${{ matrix.php-version != '8.2' && matrix.dependencies != '' }}
run: sudo phpdismod xdebug

- name: Self-update Composer
run: composer self-update

- name: Install dependencies
run: composer update --prefer-dist ${{ matrix.dependencies }}

- name: Run tests
run: |
if [ "${{ matrix.php-version }}" == "8.2" ] && [ "${{ matrix.dependencies }}" == "" ]; then
php ./vendor/bin/phpunit --exclude-group=ignore --coverage-text --coverage-clover ./build/logs/clover.xml
else
./vendor/bin/phpunit --exclude-group=ignore
fi

- name: Run CS check
if: ${{ matrix.php-version == '8.2' && matrix.dependencies == '' }}
run: ./vendor/bin/php-cs-fixer fix -v --diff --dry-run

- name: Upload coverage to Coveralls
if: ${{ matrix.php-version == '8.2' && matrix.dependencies == '' }}
run: php vendor/bin/php-coveralls -v
55 changes: 0 additions & 55 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Copyright (c) 2018-2022, Alexander Miertsch
Copyright (c) 2018-2022, Sascha-Oliver Prolic
Copyright (c) 2018-2024, Alexander Miertsch
Copyright (c) 2018-2024, Sascha-Oliver Prolic
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
17 changes: 10 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,23 @@
"require": {
"php": "^8.1 || ^8.2",
"ext-json": "*",
"amphp/amp": "^3.0",
"amphp/http-client": "^v5.0.0-beta.17",
"amphp/byte-stream": "^v2.0.2",
"amphp/socket": "^v2.2.0",
"amphp/amp": "^3.0.2",
"amphp/http": "^v2.1.1",
"amphp/http-client": "^v5.1.0",
"amphp/byte-stream": "^v2.1.1",
"amphp/socket": "^v2.3.1",
"google/protobuf": "^v3.24.3",
"prooph/event-store": "dev-master",
"psr/log": "^3.0"
"psr/log": "^2.0|^3.0"
},
"require-dev": {
"amphp/file": "^3.0.1",
"amphp/file": "^3.1.0",
"amphp/log": "^v2.0",
"amphp/parallel": "^v2.2.2",
"amphp/parallel": "^v2.2.9",
"amphp/phpunit-util": "^3.0",
"doctrine/instantiator": "^2.0",
"friendsofphp/php-cs-fixer": "^v3.59.3",
"php-coveralls/php-coveralls": "2.7.0",
"phpspec/prophecy": "^1.17",
"phpunit/phpunit": "^9.6",
"prooph/php-cs-fixer-config": "^0.5.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-cluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* This file is part of `prooph/event-store-client`.
* (c) 2018-2022 Alexander Miertsch <[email protected]>
* (c) 2018-2022 Sascha-Oliver Prolic <[email protected]>
* (c) 2018-2024 Alexander Miertsch <[email protected]>
* (c) 2018-2024 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 3 additions & 3 deletions examples/demo-persistent-subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* This file is part of `prooph/event-store-client`.
* (c) 2018-2022 Alexander Miertsch <[email protected]>
* (c) 2018-2022 Sascha-Oliver Prolic <[email protected]>
* (c) 2018-2024 Alexander Miertsch <[email protected]>
* (c) 2018-2024 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,8 +13,8 @@

namespace Prooph\EventStoreClient;

use Prooph\EventStore\EventStorePersistentSubscription;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\EventStorePersistentSubscription;
use Prooph\EventStore\Exception\InvalidOperationException;
use Prooph\EventStore\PersistentSubscriptionSettings;
use Prooph\EventStore\ResolvedEvent;
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-read-with-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* This file is part of `prooph/event-store-client`.
* (c) 2018-2022 Alexander Miertsch <[email protected]>
* (c) 2018-2022 Sascha-Oliver Prolic <[email protected]>
* (c) 2018-2024 Alexander Miertsch <[email protected]>
* (c) 2018-2024 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
25 changes: 4 additions & 21 deletions examples/demo-read.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* This file is part of `prooph/event-store-client`.
* (c) 2018-2022 Alexander Miertsch <[email protected]>
* (c) 2018-2022 Sascha-Oliver Prolic <[email protected]>
* (c) 2018-2024 Alexander Miertsch <[email protected]>
* (c) 2018-2024 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,8 +13,6 @@

namespace Prooph\EventStoreClient;

use Prooph\EventStore\ClientErrorEventArgs;
use Prooph\EventStore\ClientReconnectingEventArgs;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\EventData;
use Prooph\EventStore\EventId;
Expand All @@ -37,23 +35,8 @@
echo 'connection closed' . PHP_EOL;
});

$connection->onErrorOccurred(function (ClientErrorEventArgs $a): void {
echo 'error' . PHP_EOL;
var_dump($a->exception()->getMessage());
});

$connection->onReconnecting(function (ClientReconnectingEventArgs $a): void {
echo 'retry: ' . $a->connection()->connectionName();
});
$connection->connect();

$connection->onDisconnected(function (): void {
echo 'DISCONNECTED';
});
try {
$connection->connect();
} catch (\Throwable $e) {
var_dump($e->getMessage()); die;
}
$slice = $connection->readStreamEventsForward(
'foo-bar',
10,
Expand Down Expand Up @@ -120,4 +103,4 @@

\var_dump($aeb);

$connection->close();
$connection->close();
6 changes: 3 additions & 3 deletions examples/demo-subscribe-to-all-from.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* This file is part of `prooph/event-store-client`.
* (c) 2018-2022 Alexander Miertsch <[email protected]>
* (c) 2018-2022 Sascha-Oliver Prolic <[email protected]>
* (c) 2018-2024 Alexander Miertsch <[email protected]>
* (c) 2018-2024 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,9 +13,9 @@

namespace Prooph\EventStoreClient;

use Prooph\EventStore\EventStoreCatchUpSubscription;
use Prooph\EventStore\CatchUpSubscriptionSettings;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\EventStoreCatchUpSubscription;
use Prooph\EventStore\ResolvedEvent;
use Prooph\EventStore\SubscriptionDropReason;
use Prooph\EventStore\UserCredentials;
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-subscribe-to-all.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* This file is part of `prooph/event-store-client`.
* (c) 2018-2022 Alexander Miertsch <[email protected]>
* (c) 2018-2022 Sascha-Oliver Prolic <[email protected]>
* (c) 2018-2024 Alexander Miertsch <[email protected]>
* (c) 2018-2024 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 3 additions & 3 deletions examples/demo-subscribe-to-stream-from-with-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* This file is part of `prooph/event-store-client`.
* (c) 2018-2022 Alexander Miertsch <[email protected]>
* (c) 2018-2022 Sascha-Oliver Prolic <[email protected]>
* (c) 2018-2024 Alexander Miertsch <[email protected]>
* (c) 2018-2024 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,9 +13,9 @@

namespace Prooph\EventStoreClient;

use Prooph\EventStore\EventStoreCatchUpSubscription;
use Prooph\EventStore\CatchUpSubscriptionSettings;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\EventStoreCatchUpSubscription;
use Prooph\EventStore\ResolvedEvent;
use Prooph\EventStore\SubscriptionDropReason;
use Throwable;
Expand Down
6 changes: 3 additions & 3 deletions examples/demo-subscribe-to-stream-from.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* This file is part of `prooph/event-store-client`.
* (c) 2018-2022 Alexander Miertsch <[email protected]>
* (c) 2018-2022 Sascha-Oliver Prolic <[email protected]>
* (c) 2018-2024 Alexander Miertsch <[email protected]>
* (c) 2018-2024 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,9 +13,9 @@

namespace Prooph\EventStoreClient;

use Prooph\EventStore\EventStoreCatchUpSubscription;
use Prooph\EventStore\CatchUpSubscriptionSettings;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\EventStoreCatchUpSubscription;
use Prooph\EventStore\ResolvedEvent;
use Prooph\EventStore\SubscriptionDropReason;
use Throwable;
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-subscribe-to-stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* This file is part of `prooph/event-store-client`.
* (c) 2018-2022 Alexander Miertsch <[email protected]>
* (c) 2018-2022 Sascha-Oliver Prolic <[email protected]>
* (c) 2018-2024 Alexander Miertsch <[email protected]>
* (c) 2018-2024 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
4 changes: 2 additions & 2 deletions src/ClientOperations/AbstractOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* This file is part of `prooph/event-store-client`.
* (c) 2018-2022 Alexander Miertsch <[email protected]>
* (c) 2018-2022 Sascha-Oliver Prolic <[email protected]>
* (c) 2018-2024 Alexander Miertsch <[email protected]>
* (c) 2018-2024 Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
Loading
Loading