Gotchas Flashcards

1
Q
What's wrong here
@Configuration
@Scope("singleton")
public class MetadataConfig {
  @Bean
  public DatasetMetadataContainer make(OnboardingTeamCsvToDatasetReader reader) {
    var stream = this.getClass().getResourceAsStream("/datasets.csv");
    return reader.readFrom(stream);
  }
  @Bean
  public PackageMetadataContainer make(OnboardingTeamCsvToPackageReader reader) {
    var stream = this.getClass().getResourceAsStream("/packages.csv");
    return reader.readFrom(stream);
  }
}
A

Apparently if the same name of method is used then even though there’s distinct signature (parameter) and return value - Spring 5 fails to find one of the dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why gunicorn terminates gevent based worker but not fastAPI uvicorn one if running blocking task

A

Gunicorn requires workers to communicate with main process within keep-alive period.
FastAPI submits blocking tasks to thread pool which runs independently from event-loop thread so worker is always responding.
Gevent worker just runs on event-loop thread, blocks responsiveness so gunicorn timeouts work.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly