Skip to content

Commit

Permalink
Improved naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixRilling committed Jun 18, 2023
1 parent 346c165 commit 7126bf4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public void runInAutoQueryMode(@NotNull DataType dataType) {
final WorkQueueRepository workQueueRepository = findBeanForDataType(dataType, WorkQueueRepository.class);
final AbstractEnrichmentService<?, ?> enrichmentService = findBeanForDataType(dataType, AbstractEnrichmentService.class);

long count = workQueueRepository.countFromWorkQueue();
long count = workQueueRepository.countWorkQueue();
while (count > 0) {
LOGGER.info("{} auto-query entities remaining.", count);
for (UUID mbid : workQueueRepository.findFromWorkQueue(AUTO_QUERY_CHUNK_SIZE)) {
for (UUID mbid : workQueueRepository.queryWorkQueue(AUTO_QUERY_CHUNK_SIZE)) {
executeEnrichment(dataType, mbid, enrichmentService);
}
count = workQueueRepository.countFromWorkQueue();
count = workQueueRepository.countWorkQueue();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public class ReleaseGroupRepository implements WorkQueueRepository {
}

@Override
public long countFromWorkQueue() {
public long countWorkQueue() {
return Objects.requireNonNull(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM musicbrainz_enricher.release_group_work_queue", Long.class));
}

@Override
public @NotNull List<UUID> findFromWorkQueue(int limit) {
public @NotNull List<UUID> queryWorkQueue(int limit) {
List<UUID> mbids = jdbcTemplate.query("SELECT rg.gid FROM musicbrainz_enricher.release_group_work_queue rg LIMIT ?", (rs, rowNum) -> rs.getObject("gid", UUID.class), limit);
return Collections.unmodifiableList(mbids);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public class ReleaseRepository implements WorkQueueRepository {
}

@Override
public long countFromWorkQueue() {
public long countWorkQueue() {
return Objects.requireNonNull(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM musicbrainz_enricher.release_work_queue", Long.class));
}


@Override
public @NotNull List<UUID> findFromWorkQueue(int limit) {
public @NotNull List<UUID> queryWorkQueue(int limit) {
List<UUID> mbids = jdbcTemplate.query("SELECT r.gid FROM musicbrainz_enricher.release_work_queue r LIMIT ?", (rs, rowNum) -> rs.getObject("gid", UUID.class), limit);
return Collections.unmodifiableList(mbids);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.UUID;

public interface WorkQueueRepository extends DataTypeAware {
long countFromWorkQueue();
long countWorkQueue();

@NotNull List<UUID> findFromWorkQueue(int limit);
@NotNull List<UUID> queryWorkQueue(int limit);
}

0 comments on commit 7126bf4

Please sign in to comment.