Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-micro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
without authentication
meibuyu-micro
Commits
5ab1c85f
Commit
5ab1c85f
authored
Feb 12, 2022
by
Liu lu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
异步协程与异步日志批处理
parent
65ba2ba9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
LogTraceQueue.php
src/Handler/LogTrace/LogTraceQueue.php
+3
-3
RedisQueueBatchHandler.php
src/Handler/RedisQueueBatchHandler.php
+1
-1
No files found.
src/Handler/LogTrace/LogTraceQueue.php
View file @
5ab1c85f
...
@@ -12,7 +12,7 @@ class LogTraceQueue extends RedisQueueBatchHandler
...
@@ -12,7 +12,7 @@ class LogTraceQueue extends RedisQueueBatchHandler
protected
function
specifyQueueName
()
protected
function
specifyQueueName
()
{
{
$this
->
queue_name
=
'
LogTraceQueue'
;
$this
->
queue_name
=
env
(
'APP_NAME'
)
.
':
LogTraceQueue'
;
}
}
/**
/**
...
@@ -28,7 +28,7 @@ class LogTraceQueue extends RedisQueueBatchHandler
...
@@ -28,7 +28,7 @@ class LogTraceQueue extends RedisQueueBatchHandler
$updateArr
[
$arr
[
'request_id'
]][
'is_completed'
]
=
$arr
[
'is_completed'
];
$updateArr
[
$arr
[
'request_id'
]][
'is_completed'
]
=
$arr
[
'is_completed'
];
$process_info
=
isset
(
$updateArr
[
$arr
[
'request_id'
]][
'process_info'
])
?
$process_info
=
isset
(
$updateArr
[
$arr
[
'request_id'
]][
'process_info'
])
?
(
$updateArr
[
$arr
[
'request_id'
]][
'process_info'
]
.
"
\n\n
"
)
:
''
;
$updateArr
[
$arr
[
'request_id'
]][
'process_info'
]
:
''
;
$updateArr
[
$arr
[
'request_id'
]][
'process_info'
]
=
$process_info
.
$arr
[
'process_info'
];
$updateArr
[
$arr
[
'request_id'
]][
'process_info'
]
=
$process_info
.
$arr
[
'process_info'
];
...
@@ -44,7 +44,7 @@ class LogTraceQueue extends RedisQueueBatchHandler
...
@@ -44,7 +44,7 @@ class LogTraceQueue extends RedisQueueBatchHandler
if
(
empty
(
$originLogs
[
$item
[
'request_id'
]]))
return
$item
;
if
(
empty
(
$originLogs
[
$item
[
'request_id'
]]))
return
$item
;
$item
[
'process_info'
]
=
$originLogs
[
$item
[
'request_id'
]]
.
"
\n\n
"
.
$item
[
'process_info'
];
$item
[
'process_info'
]
=
$originLogs
[
$item
[
'request_id'
]]
.
$item
[
'process_info'
];
return
$item
;
return
$item
;
},
$updateArr
);
},
$updateArr
);
...
...
src/Handler/RedisQueueBatchHandler.php
View file @
5ab1c85f
...
@@ -71,7 +71,7 @@ abstract class RedisQueueBatchHandler
...
@@ -71,7 +71,7 @@ abstract class RedisQueueBatchHandler
$arr
=
$redis
->
lRange
(
$this
->
queue_name
,
0
,
self
::
BATCH_DEAL_NUM
-
1
);
$arr
=
$redis
->
lRange
(
$this
->
queue_name
,
0
,
self
::
BATCH_DEAL_NUM
-
1
);
//取完 从队列删掉
//取完 从队列删掉
$redis
->
lTrim
(
$this
->
queue_name
,
self
::
BATCH_DEAL_NUM
,
-
1
);
$redis
->
lTrim
(
$this
->
queue_name
,
count
(
$arr
)
,
-
1
);
//数据格式化
//数据格式化
$formatArr
=
array_map
(
function
(
$item
){
$formatArr
=
array_map
(
function
(
$item
){
return
json_decode
(
$item
,
true
);
return
json_decode
(
$item
,
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment