Skip to content

Commit

Permalink
feat(bot): create new instance of executor service at every execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Inerska committed Mar 24, 2024
1 parent 1767d48 commit 45ddc2d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
@AllArgsConstructor
public class StudyTimerCmd implements DBACommand {

private final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();

/**
* Execute the command
*
Expand All @@ -51,6 +49,8 @@ public void execute(SlashCommandInteractionEvent event) {

EmbedBuilder embedBuilder = new EmbedBuilder().setTitle("⏰ Timer d'étude").setDescription("**" + title + "**\n" + description).setColor(Color.BLUE).setFooter("Temps restant : " + formatDuration(duration));

ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();

event.replyEmbeds(embedBuilder.build()).queue(message -> {
executor.scheduleAtFixedRate(() -> {
remainingSeconds.getAndDecrement();
Expand Down

0 comments on commit 45ddc2d

Please sign in to comment.