当前位置: 首页 > news >正文

使用word做网站网站改版文案包装

使用word做网站,网站改版文案包装,做网站需要融资,上海市工商局官网之前在工作中使用 Laravel Octane 的 concurrently 处理并发时#xff0c;发现在队列和定时任务中不会触发并发效果。经过分析#xff0c;作了如下猜测#xff1a;队列和定时任务都属于一个独立的进程#xff0c;与 Octane 服务无关#xff0c;而 Octane concurrently 恰恰…之前在工作中使用 Laravel Octane 的 concurrently 处理并发时发现在队列和定时任务中不会触发并发效果。经过分析作了如下猜测队列和定时任务都属于一个独立的进程与 Octane 服务无关而 Octane concurrently 恰恰需要在 Octane 环境下才能运行。 后来通过代码进行环境检测和查看 php 的进程证明猜想成立。 info(check env, [served by octane isset($_SERVER[LARAVEL_OCTANE]) ((int)$_SERVER[LARAVEL_OCTANE] 1),on swoole server (extension_loaded(swoole) || extension_loaded(openswoole)) app()-bound(Server::class) ]);为了能够在任意代码中实现并发我们研究参考了 Hyperf 框架关于协程的代码然后抽取了如下两个类 ?phpnamespace App\Services;use App\Exceptions\ParallelExecutionException; use Laravel\Octane\Facades\Octane; use Throwable; use Swoole\Coroutine as Co;class Parallel {protected array $callbacks [];protected array $results [];/*** var Throwable[]*/protected array $throwables [];public function add(callable $callable, $key null): void{if (is_null($key)) {$this-callbacks[] $callable;} else {$this-callbacks[$key] $callable;}}public function wait(bool $throw true): array{if (isset($_SERVER[LARAVEL_OCTANE]) ((int)$_SERVER[LARAVEL_OCTANE] 1)) {return Octane::concurrently($this-callbacks, 300000);}app(log)-useLoggingLoopDetection(false);Co\run(function () {foreach ($this-callbacks as $key $callback) {Co::create(function () use ($callback, $key) {try {$this-results[$key] $callback();} catch (Throwable $throwable) {$this-throwables[$key] $throwable;unset($this-results[$key]);}});}});if ($throw ($throwableCount count($this-throwables)) 0) {$message Detecting . $throwableCount . throwable occurred during parallel execution: . PHP_EOL . $this-formatThrowAbles($this-throwables);$executionException new ParallelExecutionException($message);$executionException-setResults($this-results);$executionException-setThrowAbles($this-throwables);unset($this-results, $this-throwables);throw $executionException;}app(log)-useLoggingLoopDetection(true);return $this-results;}private function formatThrowAbles(array $throwables): string{$output ;foreach ($throwables as $key $value) {$output . sprintf((%s) %s: %s . PHP_EOL . %s . PHP_EOL, $key, get_class($value), $value-getMessage(), $value-getTraceAsString());}return $output;} }?phpnamespace App\Exceptions;use RuntimeException;class ParallelExecutionException extends RuntimeException {protected array $results [];protected array $throwables [];public function getResults(): array{return $this-results;}public function setResults(array $results): void{$this-results $results;}public function getThrowAbles(): array{return $this-throwables;}public function setThrowAbles(array $throwables): array{return $this-throwables $throwables;} }其中第一个类的作用是检测系统是否运行在 Octane 环境下是则调用Octane concurrently否则就执行 Swoole 协程代码使用起来也比较简单 $parallel new Parallel(); $parallel-add(fn() $this-analysisStructure(), structure); $parallel-add(fn() $this-analysisHabit(), habit); [structure $structure,habit $habit, ] $parallel-wait();之所以没有完全使用 Swoole 协程是因为相比之下Octane 代码更加优雅我们在期待着某天更新后Octane concurrently 也能直接在队列中运行使用。 第二个类的作用比较简单就是对协程中异常的一个定义。 另外在分析过程中我们也发现了一个比较有意思的事情 如图所示当我在路由中运行检测代码时Octane 和 Swoole Server 都为 true在控制器中运行检测代码时又只有 Octane 为true为什么会有这样的区分我个人猜测是 Octane 在将框架代码读进内存时特意跳过了控制器中的代码以避免数据更新不及时等问题。 有知道具体原因的小伙伴欢迎留言探讨。
http://www.w-s-a.com/news/877361/

相关文章:

  • 营销型外贸网站建设软件备案域名出租
  • 网站域名禁止续费m99ww094cn 苍井空做的网站
  • 上海建设工程网站大同网站建设熊掌号
  • 设计类书籍网站江苏网站建设简介模板
  • 手机企业网站推广c 手机app开发
  • 网站建设需要多少天凡客建设网站稳定吗
  • 房天下网站建设女生说wap是什么意思
  • 网站开发安全机制北京做网站多少钱合理
  • 扁平化 公司网站建设大型视频网站需要的资金量
  • 免费建各种网站淄博网站建设yx718
  • 凡科网建站入门教程运城市网站建设
  • 黄浦区未成年人思想道德建设网站oa系统是什么
  • 微信里的网站怎么做电子商务网站开发平台
  • 易企秀网站怎么做轮播图网站建设张世勇
  • 网站备案幕布尺寸建立网页的几个步骤
  • pc网站页面找出网站所有死链接
  • 专业做seo的网站网站内连接
  • 阿里云网站开发服务器想开网站建设公司
  • 网站开发不足之处茶叶seo网站推广与优化方案
  • 响应式网站建设系统网站优化怎么做 有什么技巧
  • 班级网站做哪些方面wordpress标签 扩展
  • 如何在电商上购物网站Wordpress 域名授权插件
  • 网站建设后台怎么弄昆明如何做好关键词推广
  • 自己怎么做个网站优酷视频网站开发
  • 2015做网站前景电子商务营销的发展现状
  • 官方网站建设情况说明电子商务网站开发的形式有
  • 网站建设玖金手指排名11专业建站公司建站系统
  • 全球排名前十网站百度网站官网网址
  • 商家在携程旅游网站怎样做宣传做网站公司苏州
  • 芜湖做网站都有哪些广州音乐制作公司