Skip to content

Commit

Permalink
chore: stop congestion calculating
Browse files Browse the repository at this point in the history
  • Loading branch information
drunkenhw committed Sep 29, 2023
1 parent 5a47f9a commit 1814339
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ResponseEntity<StationsSummaryResponse> getStationsSummary(@RequestParam
return ResponseEntity.ok(new StationsSummaryResponse(stations));
}

@GetMapping("/stations/regions")
@GetMapping("/stations/markers/regions")
public ResponseEntity<List<RegionMarker>> getMarkerByRegions(@RequestParam List<String> regions) {
return ResponseEntity.ok(stationQueryService.findMarkersByRegions(regions));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.carffeine.carffeine.station.infrastructure.repository.charger.dto.ChargerStatusResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.time.DayOfWeek;
Expand All @@ -26,7 +25,7 @@ public class StationService {
private final PeriodicCongestionCustomRepository periodicCongestionCustomRepository;
private final AtomicBoolean isRunning = new AtomicBoolean(false);

@Scheduled(cron = "0 0/10 * * * *")
// @Scheduled(cron = "0 0/10 * * * *")
public void calculateCongestion() {
if (isRunning.compareAndSet(false, true)) {
LocalDateTime now = LocalDateTime.now();
Expand All @@ -36,7 +35,7 @@ public void calculateCongestion() {

String stationId = null;
String chargerId = null;
long limit = 1000;
long limit = 10000;
long size = limit;

while (limit == size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,9 @@ class StationControllerTest extends MockBeanInjection {
// when
when(stationQueryService.findMarkersByRegions(List.of("seoul")))
.thenReturn(List.of(new RegionMarker("서울", BigDecimal.valueOf(37.540705), BigDecimal.valueOf(126.956764), 1)));

// then
mockMvc.perform(RestDocumentationRequestBuilders.get("/stations/regions").queryParam("regions", "seoul"))
mockMvc.perform(RestDocumentationRequestBuilders.get("/stations/markers/regions").queryParam("regions", "seoul"))
.andExpect(status().isOk())
.andDo(customDocument("findMarkerByRegion",
requestParameters(
Expand Down

0 comments on commit 1814339

Please sign in to comment.