Skip to content

Commit 9594715

Browse files
committed
优化代码
1 parent bcb0a9e commit 9594715

File tree

9 files changed

+18
-11
lines changed

9 files changed

+18
-11
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
language: php
22
os: linux
3+
dist: bionic
34

45
jobs:
56
include:
7+
- php: '7.1'
8+
env: SWOOLE_VERSION="v4.5.2"
69
- php: '7.2'
710
env: SWOOLE_VERSION="v4.5.2"
811
- php: '7.3'
912
env: SWOOLE_VERSION="v4.5.2"
1013
- php: '7.4'
1114
env: SWOOLE_VERSION="v4.5.2"
15+
- php: '7.1'
16+
env: SWOOLE_VERSION="v4.4.19"
1217
- php: '7.2'
1318
env: SWOOLE_VERSION="v4.4.19"
1419
- php: '7.3'
1520
env: SWOOLE_VERSION="v4.4.19"
1621
- php: '7.4'
1722
env: SWOOLE_VERSION="v4.4.19"
23+
- php: '7.1'
24+
env: SWOOLE_VERSION="master"
1825
- php: '7.2'
1926
env: SWOOLE_VERSION="master"
2027
- php: '7.3'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# imi-queue
22

33
[![Latest Version](https://img.shields.io/packagist/v/imiphp/imi-queue.svg)](https://packagist.org/packages/imiphp/imi-queue)
4-
[![Php Version](https://img.shields.io/badge/php-%3E=7.2-brightgreen.svg)](https://secure.php.net/)
4+
[![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg)](https://secure.php.net/)
55
[![Swoole Version](https://img.shields.io/badge/swoole-%3E=4.4.0-brightgreen.svg)](https://github.com/swoole/swoole-src)
66
[![IMI License](https://img.shields.io/github/license/imiphp/imi-queue.svg)](https://github.com/imiphp/imi-queue/blob/master/LICENSE)
77

example/config/beans.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
// 队列名称
6969
'test1' => [
7070
// 使用的队列驱动
71-
'driver' => \Imi\Queue\Driver\RedisQueueDriver::class,
71+
'driver' => 'RedisQueueDriver',
7272
// 消费协程数量
7373
'co' => 1,
7474
// 消费进程数量;可能会受进程分组影响,以同一组中配置的最多进程数量为准
@@ -88,7 +88,7 @@
8888
]
8989
],
9090
'test2' => [
91-
'driver' => \Imi\Queue\Driver\RedisQueueDriver::class,
91+
'driver' => 'RedisQueueDriver',
9292
'co' => 1,
9393
'process' => 1,
9494
'timespan' => 0.1,

src/Driver/RedisQueueDriver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
namespace Imi\Queue\Driver;
33

44
use Imi\Redis\RedisManager;
5+
use Imi\Queue\Model\Message;
6+
use Imi\Bean\Annotation\Bean;
57
use Imi\Queue\Enum\QueueType;
68
use Imi\Queue\Contract\IMessage;
79
use Imi\Queue\Model\QueueStatus;
810
use Imi\Util\Traits\TDataToProperty;
911
use Imi\Queue\Exception\QueueException;
10-
use Imi\Queue\Model\Message;
1112

1213
/**
1314
* Redis 队列驱动
15+
*
16+
* @Bean("RedisQueueDriver")
1417
*/
1518
class RedisQueueDriver implements IQueueDriver
1619
{

src/Model/QueueConfig.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22
namespace Imi\Queue\Model;
33

4-
use Imi\Queue\Driver\RedisQueueDriver;
5-
64
class QueueConfig
75
{
86
/**
@@ -17,7 +15,7 @@ class QueueConfig
1715
*
1816
* @var string
1917
*/
20-
private $driver = RedisQueueDriver::class;
18+
private $driver = 'RedisQueueDriver';
2119

2220
/**
2321
* 消费协程数量

src/Service/QueueService.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Imi\Bean\Annotation\Bean;
66
use Imi\Queue\Model\QueueConfig;
77
use Imi\Queue\Driver\IQueueDriver;
8-
use Imi\Queue\Driver\RedisQueueDriver;
98
use Imi\Queue\Exception\QueueException;
109

1110
/**

src/config/config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
return [
33
'beanScan' => [
4+
'Imi\Queue\Driver',
45
'Imi\Queue\Enum',
56
'Imi\Queue\Service',
67
'Imi\Queue\Annotation',

tests/Queue/RedisQueueTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33

44
use Imi\App;
55
use Imi\Queue\Driver\IQueueDriver;
6-
use Imi\Queue\Driver\RedisQueueDriver;
76

87
class RedisQueueTest extends BaseQueueTest
98
{
109
protected function getDriver(): IQueueDriver
1110
{
12-
return App::getBean(RedisQueueDriver::class, 'imi-queue-test');
11+
return App::getBean('RedisQueueDriver', 'imi-queue-test');
1312
}
1413
}

tests/phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ go(function() use(&$statusCode){
2828
{
2929
require $phpunitPath;
3030
}
31-
PHPUnit\TextUI\Command::main();
31+
PHPUnit\TextUI\Command::main(false);
3232
} catch (\Swoole\ExitException $e) {
3333
$statusCode = $e->getStatus();
3434
}

0 commit comments

Comments
 (0)