Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
(client): fix early release bugs
Browse files Browse the repository at this point in the history
Some minor patches for bugs that crept into the initial release. Bugs
include:
- slightly large torrent files couldn't be transmitted to the server.
  turns out if the torrents meta info payload is too large (like a
  fraction of an MB), our express server would just outright reject
  it. I've upgraded the limit to take upto 50mb, which should be more
  then enough.
- setting a torrents priority to unwanted doesn't get fixed when the
  torrent is wanted again. evidently because I was carrying over the
  wanted field from the previous torrent state instead of forcing it
  to be true like it should be.
- Also lowered the interval values which were raised due to
  performance issues in development.
  • Loading branch information
mohkale committed Aug 16, 2020
1 parent ffc31d5 commit b45a1c7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/models/torrent-detailed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const TORRENT_DETAILED_BASE: Partial<TorrentDetailed> = {

export function torrentDetailedFromResponse(resp: Partial<TorrentResponse>, prev?: TorrentDetailed): TorrentDetailed {
const base = prev ? prev! : TORRENT_DETAILED_BASE
const torrent = Object.assign({}, torrentFromResponse(resp), base) as TorrentDetailed
const torrent = Object.assign({}, base, torrentFromResponse(resp)) as TorrentDetailed

return torrent
}
3 changes: 1 addition & 2 deletions client/stores/overlays-store/details/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export const setFilePriorities =
const torrentId = state.overlays.torrentDetails.torrentId
const fileStats = state.overlays.torrentDetails.torrent!.fileStats

// TODO cleanup, too much repitition
if (isPriorityType(priority)) {
switch (priority) {
case PriorityType.HIGH:
Expand All @@ -88,7 +87,7 @@ export const setFilePriorities =

return {
...stat,
wanted: isPriorityType(priority) ? stat.wanted : false,
wanted: isPriorityType(priority),
priority: isPriorityType(priority) ? priority : stat.priority,
}
})
Expand Down
4 changes: 2 additions & 2 deletions client/stores/settings-store/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ const defaultState: SettingsState = {
},

intervals: {
torrentsSync: 20000,
speedSync: 10000,
torrentsSync: 1000,
speedSync: 2000,
speedLimitsSync: 60000,
},

Expand Down
4 changes: 2 additions & 2 deletions server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const serverPromise = new Promise(resolve => resolve())
const app = express()
export default app

app.use(express.json())
app.use(express.urlencoded({ extended: true }))
app.use(express.json({ limit: '50mb' }))
app.use(express.urlencoded({ limit: '50mb', extended: true }))

app.use(morgan('dev', {
stream: { write: (msg: string) => logger.debug(msg.replace(/\n$/, '')) }
Expand Down

0 comments on commit b45a1c7

Please sign in to comment.