Quellcode durchsuchen

修改数据库最大连接数配置/getVideoDuration 方法

sgw vor 5 Tagen
Ursprung
Commit
0f146ca7de

+ 11 - 2
fs-service/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java

@@ -414,7 +414,7 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
             log.error("key中id为S:{}", videoDuration);
         }
 
-        
+
         if (videoDuration==null){
             FsUserCourseVideo video = courseVideoMapper.selectFsUserCourseVideoByVideoId(videoId);
             videoDuration=video.getDuration();
@@ -957,7 +957,16 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
     public Long getVideoDuration(Long videoId){
         //将视频时长也存到redis
         String videoRedisKey = "h5user:video:duration:" + videoId;
-        Long videoDuration = redisCache.getCacheObject(videoRedisKey);
+        Long videoDuration=0L;
+        try {
+            videoDuration = redisCache.getCacheObject(videoRedisKey);
+        }catch (Exception e){
+            String string = redisCache.getCacheObject(videoRedisKey);
+            videoDuration=Long.parseLong(string);
+            log.error("key中id为S:{}", videoDuration);
+        }
+
+
         if (videoDuration==null){
             FsUserCourseVideo video = courseVideoMapper.selectFsUserCourseVideoByVideoId(videoId);
             videoDuration=video.getDuration();

+ 5 - 5
fs-service/src/main/resources/application-druid-jzzx.yml

@@ -21,7 +21,7 @@ spring:
                 # 连接池中的最大空闲连接
                 max-idle: 8
                 # 连接池的最大数据库连接数
-                max-active: 8
+                max-active: 100
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
                 max-wait: -1ms
     datasource:
@@ -56,7 +56,7 @@ spring:
                 # 最小连接池数量
                 minIdle: 10
                 # 最大连接池数量
-                maxActive: 20
+                maxActive: 200
                 # 配置获取连接等待超时的时间
                 maxWait: 60000
                 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
@@ -73,7 +73,7 @@ spring:
                 webStatFilter:
                     enabled: true
                 statViewServlet:
-                    enabled: true
+                    enabled: false
                     # 设置白名单,不填则允许所有访问
                     allow:
                     url-pattern: /druid/*
@@ -108,7 +108,7 @@ spring:
                 # 最小连接池数量
                 minIdle: 10
                 # 最大连接池数量
-                maxActive: 20
+                maxActive: 200
                 # 配置获取连接等待超时的时间
                 maxWait: 60000
                 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
@@ -125,7 +125,7 @@ spring:
                 webStatFilter:
                     enabled: true
                 statViewServlet:
-                    enabled: true
+                    enabled: false
                     # 设置白名单,不填则允许所有访问
                     allow:
                     url-pattern: /druid/*

+ 5 - 5
fs-service/src/main/resources/application-druid-kyt.yml

@@ -22,7 +22,7 @@ spring:
         # 连接池中的最大空闲连接
         max-idle: 8
         # 连接池的最大数据库连接数
-        max-active: 8
+        max-active: 100
         # #连接池最大阻塞等待时间(使用负值表示没有限制)
         max-wait: -1ms
     database: 0
@@ -49,7 +49,7 @@ spring:
         # 最小连接池数量
         minIdle: 10
         # 最大连接池数量
-        maxActive: 20
+        maxActive: 200
         # 配置获取连接等待超时的时间
         maxWait: 60000
         # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
@@ -66,7 +66,7 @@ spring:
         webStatFilter:
           enabled: true
         statViewServlet:
-          enabled: true
+          enabled: false
           # 设置白名单,不填则允许所有访问
           allow:
           url-pattern: /druid/*
@@ -98,7 +98,7 @@ spring:
         # 最小连接池数量
         minIdle: 10
         # 最大连接池数量
-        maxActive: 20
+        maxActive: 200
         # 配置获取连接等待超时的时间
         maxWait: 60000
         # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
@@ -115,7 +115,7 @@ spring:
         webStatFilter:
           enabled: true
         statViewServlet:
-          enabled: true
+          enabled: false
           # 设置白名单,不填则允许所有访问
           allow:
           url-pattern: /druid/*