Skip to content

Commit

Permalink
Added and removed indexes, added docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SubJunk committed Dec 7, 2024
1 parent 60b8f3a commit 7befb8f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 28 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ Runs the test suite

#### `yarn run start:prod`
Starts the API and cron job in production mode. TypeScript files are compiled in memory on application start.

## Logs

To view the production logs:
1. Run `sudo sh -c "du -ch /var/lib/docker/containers/*/*-json.log"` to print the list of logs. Look for the biggest one and copy the container ID.
2. Run `docker logs -f --tail 100 CONTAINER_ID`

## Troubleshooting

If the production server is unstable, it could be because the Docker cache is filling the hard drive. To fix it, run `docker system prune -a` to clear unused stuff.
38 changes: 12 additions & 26 deletions src/models/FailedLookups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,17 @@ export interface FailedLookupsInterface {
export interface FailedLookupsInterfaceDocument extends mongoose.Document, FailedLookupsInterface {}

const FailedLookupsSchema = new Schema({
count: {
default: 1,
type: Number,
},
episode: { index: true, type: String },
imdbID: { index: true, type: String },
language: { index: true, type: String },
season: { index: true, type: String },
startYear: {
index: true,
type: String,
},
title: {
index: true,
required: true,
type: String,
},
count: { type: Number, default: 1 },
episode: { type: String },
imdbID: { type: String, index: true },
language: { type: String },
season: { type: String },
startYear: { type: String },
title: { type: String, index: true, required: true },
tmdbID: { index: true, type: Number },
year: {
index: true,
type: String,
},
failedValidation: {
default: false,
type: Boolean,
},
type: { type: String, index: true },
year: { type: String },
failedValidation: { type: Boolean, default: false },
type: { type: String },
createdAt: {
default: Date.now,
expires: THIRTY_DAYS_IN_SECONDS,
Expand All @@ -65,6 +49,8 @@ FailedLookupsSchema.index({ title: 1, language: 1, year: 1 });
FailedLookupsSchema.index({ title: 1, episode: 1, season: 1 });
FailedLookupsSchema.index({ title: 1, language: 1, episode: 1, season: 1 });
FailedLookupsSchema.index({ title: 1, type: 1 });
FailedLookupsSchema.index({ title: 1, type: 1, startYear: 1 });
FailedLookupsSchema.index({ language: 1, type: 1, imdbID: 1, tmdbID: 1, season: 1, episode: 1 })

const FailedLookups = mongoose.model<FailedLookupsInterfaceDocument>('FailedLookups', FailedLookupsSchema);

Expand Down
3 changes: 1 addition & 2 deletions src/models/MediaMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const MediaMetadataSchema: Schema = new Schema({
credits: { type: Array },
directors: { type: Array },
episode: {
index: true,
required: isTypeEpisode,
type: String,
},
Expand Down Expand Up @@ -104,7 +103,7 @@ const MediaMetadataSchema: Schema = new Schema({
trivia: { type: String },
type: { type: String, required: true },
votes: { type: String },
year: { index: true, type: String },
year: { type: String },
}, {
collection: 'media_metadata',
timestamps: true,
Expand Down

0 comments on commit 7befb8f

Please sign in to comment.