改名
This commit is contained in:
+4
-5
@@ -11,6 +11,7 @@ use ReflectionException;
|
|||||||
use Snowflake\Abstracts\Component;
|
use Snowflake\Abstracts\Component;
|
||||||
use Snowflake\Abstracts\Config;
|
use Snowflake\Abstracts\Config;
|
||||||
use Snowflake\Event;
|
use Snowflake\Event;
|
||||||
|
use Snowflake\Exception\ConfigException;
|
||||||
use Snowflake\Exception\NotFindClassException;
|
use Snowflake\Exception\NotFindClassException;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
|
|
||||||
@@ -147,9 +148,8 @@ class Producer extends Component
|
|||||||
/**
|
/**
|
||||||
* @param $topic
|
* @param $topic
|
||||||
* @param $groupId
|
* @param $groupId
|
||||||
* @param $brokers
|
* @throws ConfigException
|
||||||
* @return ProducerTopic
|
* @throws Exception
|
||||||
* @throws \Snowflake\Exception\ConfigException
|
|
||||||
*/
|
*/
|
||||||
private function beforePushMessage($topic, $groupId): void
|
private function beforePushMessage($topic, $groupId): void
|
||||||
{
|
{
|
||||||
@@ -172,7 +172,6 @@ class Producer extends Component
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TopicConf $topicConf
|
|
||||||
* @param string $topic
|
* @param string $topic
|
||||||
* @param array $message
|
* @param array $message
|
||||||
* @param string $key
|
* @param string $key
|
||||||
@@ -205,8 +204,8 @@ class Producer extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $topic
|
||||||
* @param \RdKafka\Producer $producer
|
* @param \RdKafka\Producer $producer
|
||||||
* @param ProducerTopic $producerTopic
|
* @param ProducerTopic $producerTopic
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ abstract class Crontab extends BaseObject
|
|||||||
$redis->del('crontab:' . $this->getName());
|
$redis->del('crontab:' . $this->getName());
|
||||||
$redis->del('stop:crontab:' . $this->getName());
|
$redis->del('stop:crontab:' . $this->getName());
|
||||||
} else {
|
} else {
|
||||||
$redis->set('crontab:' . ($name = $this->getName()), swoole_serialize($this));
|
$redis->set('crontab:' . ($name = $this->getName()), static::getSerialize($this));
|
||||||
$tickTime = time() + $this->getTickTime();
|
$tickTime = time() + $this->getTickTime();
|
||||||
$redis->zAdd(Producer::CRONTAB_KEY, $tickTime, $name);
|
$redis->zAdd(Producer::CRONTAB_KEY, $tickTime, $name);
|
||||||
}
|
}
|
||||||
@@ -241,6 +241,16 @@ abstract class Crontab extends BaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $class
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getSerialize($class): string
|
||||||
|
{
|
||||||
|
return serialize($class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@@ -251,7 +261,7 @@ abstract class Crontab extends BaseObject
|
|||||||
|
|
||||||
$name_md5 = $this->getName();
|
$name_md5 = $this->getName();
|
||||||
|
|
||||||
$redis->hSet(self::WAIT_END, $name_md5, serialize($this));
|
$redis->hSet(self::WAIT_END, $name_md5, static::getSerialize($this));
|
||||||
|
|
||||||
$params = call_user_func([$this, 'process'], ...$this->params);
|
$params = call_user_func([$this, 'process'], ...$this->params);
|
||||||
$redis->hDel(self::WAIT_END, $name_md5);
|
$redis->hDel(self::WAIT_END, $name_md5);
|
||||||
|
|||||||
Reference in New Issue
Block a user