You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/10/09 10:38:43 UTC

[GitHub] [skywalking] lujiajing1126 commented on a diff in pull request #9744: optimize the creation conditions of profiling task

lujiajing1126 commented on code in PR #9744:
URL: https://github.com/apache/skywalking/pull/9744#discussion_r990770793


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/trace/ProfileTaskMutationService.java:
##########
@@ -140,14 +140,16 @@ private String checkDataSuccess(final String serviceId,
 
         // Each service can monitor up to 1 endpoints during the execution of tasks
         long startTimeBucket = TimeBucket.getMinuteTimeBucket(monitorStartTime);
-        long endTimeBucket = TimeBucket.getMinuteTimeBucket(monitorEndTime);
         final List<ProfileTask> alreadyHaveTaskList = getProfileTaskDAO().getTaskList(
-            serviceId, null, startTimeBucket, endTimeBucket, 1);
+            serviceId, null, startTimeBucket, null, null);
         if (CollectionUtils.isNotEmpty(alreadyHaveTaskList)) {
-            // if any task time bucket in this range, means already have task, because time bucket is base on task end time
-            return "current service already has monitor task execute at this time";
+            for (ProfileTask profileTask : alreadyHaveTaskList) {
+                if (profileTask.getStartTime() <= monitorEndTime) {
+                    // if any task time bucket in this range, means already have task, because time bucket is base on task end time

Review Comment:
   ```suggestion
                       // if the startTime is less or equal than the endTime of the newly created task, i.e. there is overlap between two tasks, it is an invalid case
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org