Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
streamingUserPortrait
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
赵威
streamingUserPortrait
Commits
bbe53666
Commit
bbe53666
authored
Feb 07, 2021
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove test
parent
feb95858
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
27 deletions
+44
-27
Main.scala
src/main/scala/com.gmei.up/Main.scala
+1
-2
Redis.scala
src/main/scala/com.gmei.up/utils/Redis.scala
+43
-25
No files found.
src/main/scala/com.gmei.up/Main.scala
View file @
bbe53666
...
...
@@ -45,9 +45,8 @@ object Main extends LazyLogging {
"172.16.44.25:9092,172.16.44.31:9092,172.16.44.45:9092"
)
// TODO remove test
val
kafkaConsumer
=
new
FlinkKafkaConsumer
[
UserInfo
](
"gm-portrait-update-device
-test
"
,
"gm-portrait-update-device"
,
new
UserInfoDeserializationSchema
,
kafkaConsumerProperties
)
...
...
src/main/scala/com.gmei.up/utils/Redis.scala
View file @
bbe53666
...
...
@@ -34,34 +34,47 @@ object Redis {
)
:
Unit
=
{
val
key
=
s
"streaming:candidate:${contentType}:device_id:${deviceId}"
contentEitherFuture
match
{
case
Left
(
e
)
=>
e
.
printStackTrace
()
case
Right
(
contentFuture
)
=>
pRc4Pool
.
withClient
{
client
=>
contentFuture
.
foreach
{
seq
=>
val
ids
=
seq
.
map
(
c
=>
c
.
id
)
if
(
ids
.
size
>
0
)
{
client
.
del
(
key
)
ids
.
foreach
{
id
=>
// println(id)
client
.
rpush
(
key
,
id
)
}
client
.
expire
(
key
,
60
*
60
*
24
*
15
)
val
total
=
System
.
currentTimeMillis
-
timeBegin
if
(
total
>
1000
&&
total
<
50000
)
{
DingTalk
.
send
(
Map
(
"method"
->
"Redis.save"
,
"deviceId"
->
deviceId
,
"contentType"
->
contentType
,
"description"
->
"从流开始处理到存入结果的总耗时"
,
"streamTotalSeconds"
->
s
"${total}ms"
try
{
contentEitherFuture
match
{
case
Left
(
e
)
=>
e
.
printStackTrace
()
case
Right
(
contentFuture
)
=>
pRc4Pool
.
withClient
{
client
=>
contentFuture
.
foreach
{
seq
=>
val
ids
=
seq
.
map
(
c
=>
c
.
id
)
if
(
ids
.
size
>
0
)
{
client
.
del
(
key
)
ids
.
foreach
{
id
=>
// println(id)
client
.
rpush
(
key
,
id
)
}
client
.
expire
(
key
,
60
*
60
*
24
*
15
)
val
total
=
System
.
currentTimeMillis
-
timeBegin
if
(
total
>
1000
&&
total
<
50000
)
{
DingTalk
.
send
(
Map
(
"method"
->
"Redis.save"
,
"deviceId"
->
deviceId
,
"contentType"
->
contentType
,
"description"
->
"从流开始处理到存入结果的总耗时"
,
"streamTotalSeconds"
->
s
"${total}ms"
)
)
)
}
}
}
}
}
}
}
catch
{
case
e
:
Throwable
=>
DingTalk
.
send
(
Map
(
"method"
->
"Redis.save"
,
"deviceId"
->
deviceId
,
"contentType"
->
contentType
,
"error"
->
e
.
getStackTrace
.
mkString
(
"\n"
)
),
contentType
=
"exception"
)
}
}
...
...
@@ -88,7 +101,12 @@ object Redis {
}
catch
{
case
e
:
Throwable
=>
DingTalk
.
send
(
Map
(
"method"
->
"Redis.saveServiceDiary"
,
"error"
->
e
.
getStackTrace
.
mkString
(
"\n"
)),
Map
(
"method"
->
"Redis.saveServiceDiary"
,
"deviceId"
->
deviceId
,
"contentType"
->
"service_diary"
,
"error"
->
e
.
getStackTrace
.
mkString
(
"\n"
)
),
contentType
=
"exception"
)
}
...
...
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