Skip to content

Commit

Permalink
Revert "Merge pull request #12 from ADPRO-C11/async"
Browse files Browse the repository at this point in the history
This reverts commit 697428a, reversing
changes made to 130fa41.

The Sonarcloud setting is not working yet, fixing it soon.
  • Loading branch information
asteriskzie committed May 19, 2024
1 parent 1316bfb commit 4bc3c8f
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 49 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ jobs:
name: Test
runs-on: ubuntu-latest
needs: build
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: snackscription_review
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand Down
18 changes: 2 additions & 16 deletions src/main/java/snackscription/review/ReviewApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,14 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.Executor;

@EnableAsync
@SpringBootApplication
public class ReviewApplication {

public static void main(String[] args) {
SpringApplication.run(ReviewApplication.class, args);
}

@Bean
public Executor taskExecutor () {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(1);
executor.setMaxPoolSize(1);
executor.setQueueCapacity(500);
executor.setThreadNamePrefix("GithubLookup-");
executor.initialize();
return executor;

}

}
10 changes: 0 additions & 10 deletions src/main/java/snackscription/review/service/ReviewService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;

import org.springframework.scheduling.annotation.Async;
import java.util.concurrent.atomic.AtomicInteger;

import io.micrometer.core.instrument.composite.CompositeMeterRegistry;
Expand All @@ -22,7 +19,6 @@
@Component
public class ReviewService {
private ReviewRepository reviewRepository;
private SentimentAnalysisService sentimentAnalysisService;

public ReviewService (ReviewRepository reviewRepository) {
this.reviewRepository = reviewRepository;
Expand Down Expand Up @@ -80,12 +76,6 @@ public Review rejectReview(String subsbox, String user) throws Exception {
return reviewRepository.save(review);
}

@Async
public CompletableFuture<String> analyzeSentimentAsync(String reviewText) {
String sentiment = sentimentAnalysisService.analyze(reviewText);
return CompletableFuture.completedFuture(sentiment);
}

public void deleteReview(String subsbox, String user) throws Exception {
Review review = reviewRepository.findByIdSubsboxAndIdAuthor(subsbox, user);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,5 @@ public void assertEqualReview(Review review1, Review review2) {
assertEquals(review1.getAuthor(), review2.getAuthor());
assertEquals(review1.getSubsbox(), review2.getSubsbox());
}

@Test
public void analyzeSentimentAsyncTest() {

}
}

0 comments on commit 4bc3c8f

Please sign in to comment.