Skip to content

Commit

Permalink
Merge pull request #1215 from shlinkio/develop
Browse files Browse the repository at this point in the history
Release 2.9.2
  • Loading branch information
acelaya authored Oct 23, 2021
2 parents ff50d60 + 9030e5e commit dc8f5d0
Show file tree
Hide file tree
Showing 39 changed files with 190 additions and 26 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).

## [Unreleased]
## [2.9.2] - 2021-10-23
### Added
* *Nothing*

Expand All @@ -18,7 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
* *Nothing*

### Fixed
* [#1210](https://github.com/shlinkio/shlink/issues/1210) Fixed real time updates not being notified.
* [#1210](https://github.com/shlinkio/shlink/issues/1210) Fixed real time updates not being notified due to an incorrect handling of db transactions on multi-process tasks.
* [#1211](https://github.com/shlinkio/shlink/issues/1211) Fixed `There is no active transaction` error when running migrations in MySQL/Mariadb after updating to doctrine-migrations 3.3.
* [#1197](https://github.com/shlinkio/shlink/issues/1197) Fixed amount of task workers provided via config option or env var not being validated to ensure enough workers to process all parallel tasks.


## [2.9.1] - 2021-10-11
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"akrabat/ip-address-middleware": "^2.0",
"cakephp/chronos": "^2.2",
"cocur/slugify": "^4.0",
"doctrine/migrations": "^3.2 <3.3",
"doctrine/migrations": "^3.3",
"doctrine/orm": "^2.9",
"endroid/qr-code": "^4.2",
"geoip2/geoip2": "^2.11",
Expand Down Expand Up @@ -51,7 +51,7 @@
"shlinkio/shlink-config": "^1.2",
"shlinkio/shlink-event-dispatcher": "^2.1",
"shlinkio/shlink-importer": "^2.3.1",
"shlinkio/shlink-installer": "^6.2",
"shlinkio/shlink-installer": "^6.2.1",
"shlinkio/shlink-ip-geolocation": "^2.0",
"symfony/console": "^5.3",
"symfony/filesystem": "^5.3",
Expand All @@ -73,7 +73,7 @@
"phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-master",
"shlinkio/php-coding-standard": "~2.2.0",
"shlinkio/shlink-test-utils": "^2.2",
"shlinkio/shlink-test-utils": "^2.3",
"symfony/var-dumper": "^5.3",
"veewee/composer-run-parallel": "^1.0"
},
Expand Down
32 changes: 19 additions & 13 deletions config/autoload/swoole.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@

use function Shlinkio\Shlink\Common\env;

return [
use const Shlinkio\Shlink\MIN_TASK_WORKERS;

'mezzio-swoole' => [
// Setting this to true can have unexpected behaviors when running several concurrent slow DB queries
'enable_coroutine' => false,
return (static function () {
$taskWorkers = (int) env('TASK_WORKER_NUM', 16);

'swoole-http-server' => [
'host' => '0.0.0.0',
'port' => (int) env('PORT', 8080),
'process-name' => 'shlink',
return [

'options' => [
'worker_num' => (int) env('WEB_WORKER_NUM', 16),
'task_worker_num' => (int) env('TASK_WORKER_NUM', 16),
'mezzio-swoole' => [
// Setting this to true can have unexpected behaviors when running several concurrent slow DB queries
'enable_coroutine' => false,

'swoole-http-server' => [
'host' => '0.0.0.0',
'port' => (int) env('PORT', 8080),
'process-name' => 'shlink',

'options' => [
'worker_num' => (int) env('WEB_WORKER_NUM', 16),
'task_worker_num' => $taskWorkers < MIN_TASK_WORKERS ? MIN_TASK_WORKERS : $taskWorkers,
],
],
],
],

];
];
})();
1 change: 1 addition & 0 deletions config/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
const DEFAULT_QR_CODE_MARGIN = 0;
const DEFAULT_QR_CODE_FORMAT = 'png';
const DEFAULT_QR_CODE_ERROR_CORRECTION = 'l';
const MIN_TASK_WORKERS = 4;
2 changes: 1 addition & 1 deletion config/test/bootstrap_api_tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
);
});

$testHelper->createTestDb();
$testHelper->createTestDb(['bin/cli', 'db:create'], ['bin/cli', 'db:migrate']);
ApiTest\ApiTestCase::setApiClient($httpClient);
ApiTest\ApiTestCase::setSeedFixturesCallback(fn () => $testHelper->seedFixtures($em, $config['data_fixtures'] ?? []));
7 changes: 6 additions & 1 deletion data/migrations/Version20160819142757.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public function up(Schema $schema): void
*/
public function down(Schema $schema): void
{
$db = $this->connection->getDatabasePlatform()->getName();
$this->connection->getDatabasePlatform()->getName();
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20160820191203.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,9 @@ public function down(Schema $schema): void
$schema->dropTable('short_urls_in_tags');
$schema->dropTable('tags');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20171021093246.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@ public function down(Schema $schema): void
$shortUrls->dropColumn('valid_since');
$shortUrls->dropColumn('valid_until');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20171022064541.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ public function down(Schema $schema): void

$shortUrls->dropColumn('max_visits');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20180801183328.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ private function setSize(Schema $schema, int $size): void
{
$schema->getTable('short_urls')->getColumn('short_code')->setLength($size);
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20180913205455.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,9 @@ public function down(Schema $schema): void
{
// Nothing to rollback
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20180915110857.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ public function down(Schema $schema): void
{
// Nothing to run
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20181020060559.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,9 @@ public function down(Schema $schema): void
{
// No down
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20181020065148.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ public function down(Schema $schema): void
{
// No down
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20181110175521.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ private function getUserAgentColumn(Schema $schema): Column
{
return $schema->getTable('visits')->getColumn('user_agent');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20190824075137.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ private function getRefererColumn(Schema $schema): Column
{
return $schema->getTable('visits')->getColumn('referer');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20190930165521.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ public function down(Schema $schema): void
$schema->getTable('short_urls')->dropColumn('domain_id');
$schema->dropTable('domains');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20191001201532.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ public function down(Schema $schema): void
$shortUrls->dropIndex('unique_short_code_plus_domain');
$shortUrls->addUniqueIndex(['short_code']);
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20191020074522.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ private function getOriginalUrlColumn(Schema $schema): Column
{
return $schema->getTable('short_urls')->getColumn('original_url');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20200105165647.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,9 @@ public function down(Schema $schema): void
$visitLocations->dropColumn($colName);
}
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20200106215144.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,9 @@ public function down(Schema $schema): void
]);
}
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20200110182849.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@ public function down(Schema $schema): void
{
// No need (and no way) to undo this migration
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20200323190014.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ public function down(Schema $schema): void

$visitLocations->dropColumn('is_empty');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20200503170404.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ public function down(Schema $schema): void
$this->skipIf(! $visits->hasIndex(self::INDEX_NAME));
$visits->dropIndex(self::INDEX_NAME);
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20201023090929.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@ public function down(Schema $schema): void
$shortUrls->dropColumn('import_original_short_code');
$shortUrls->dropIndex('unique_imports');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20201102113208.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,9 @@ public function down(Schema $schema): void
$shortUrls->removeForeignKey('FK_' . self::API_KEY_COLUMN);
$shortUrls->dropColumn(self::API_KEY_COLUMN);
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20210102174433.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,9 @@ public function down(Schema $schema): void
$schema->getTable(self::TABLE_NAME)->dropIndex('UQ_role_plus_api_key');
$schema->dropTable(self::TABLE_NAME);
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20210118153932.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ public function up(Schema $schema): void
public function down(Schema $schema): void
{
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20210202181026.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ public function down(Schema $schema): void
$shortUrls->dropColumn(self::TITLE);
$shortUrls->dropColumn('title_was_auto_resolved');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20210207100807.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@ public function down(Schema $schema): void
$visits->dropColumn('visited_url');
$visits->dropColumn('type');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20210306165711.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ public function down(Schema $schema): void

$apiKeys->dropColumn(self::COLUMN);
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20210522051601.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ public function down(Schema $schema): void
$this->skipIf(! $shortUrls->hasColumn('crawlable'));
$shortUrls->dropColumn('crawlable');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20210522124633.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ public function down(Schema $schema): void
$this->skipIf(! $visits->hasColumn(self::POTENTIAL_BOT_COLUMN));
$visits->dropColumn(self::POTENTIAL_BOT_COLUMN);
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
5 changes: 5 additions & 0 deletions data/migrations/Version20210720143824.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ public function down(Schema $schema): void
$domainsTable->dropColumn('regular_not_found_redirect');
$domainsTable->dropColumn('invalid_short_url_redirect');
}

public function isTransactional(): bool
{
return $this->connection->getDatabasePlatform()->getName() !== 'mysql';
}
}
Loading

0 comments on commit dc8f5d0

Please sign in to comment.