Skip to content

Commit 5050077

Browse files
authored
Merge pull request #1 from SepteniTechnology/issue-redis-not-loaded
Fix issue set SequelResolver while redis not loaded
2 parents 39fc60f + b7d8862 commit 5050077

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [Unreleased](https://gitlab.devsep.com/septech-php/septech-laravel/snowflake/-/compare/v1.0.2...master)
7+
## [Unreleased](https://gitlab.devsep.com/septech-php/septech-laravel/snowflake/-/compare/v1.0.3...master)
8+
9+
## [v1.0.3 - 2020-11-11](https://github.com/SepteniTechnology/laravel-snowflake/compare/v1.0.2...v1.0.3)
10+
### Fixed
11+
- Fixed set resolver while redis not loaded
12+
813

914
## [v1.0.2 - 2020-09-01](https://github.com/SepteniTechnology/laravel-snowflake/compare/v1.0.1...v1.0.2)
1015
### Changed

SnowflakeServiceProvider.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,18 @@ protected function registerSnowflakeInstance()
4343

4444
$instance->setStartTimeStamp(strtotime($config->get('snowflake.epoch')));
4545

46-
if (! $app->runningUnitTests() && ! $app->isLocal()) {
46+
47+
if (! $app->runningUnitTests() && ! $app->isLocal() && $this->hasRedis()) {
4748
$cacheStore = $app->make('cache')->store($config->get('snowflake.cache_store'));
4849
$instance->setSequenceResolver(new LaravelSequenceResolver($cacheStore));
4950
}
5051

5152
return $instance;
5253
});
5354
}
55+
56+
protected function hasRedis()
57+
{
58+
return extension_loaded('redis');
59+
}
5460
}

0 commit comments

Comments
 (0)