Bring back polling but bump up timeout

- Polling is needed because status post requires the media to be done processing (not just uploaded)
- But the default timeout set in masto.js is 3s, a bit too low if uploading a large video
- Bumping up to 30s
This commit is contained in:
Lim Chee Aun 2022-12-20 13:29:38 +08:00
parent 9bc5340714
commit 5e687e871f
3 changed files with 3 additions and 1 deletions

View file

@ -144,6 +144,7 @@ export function App() {
url: `https://${instanceURL}`, url: `https://${instanceURL}`,
accessToken, accessToken,
disableVersionCheck: true, disableVersionCheck: true,
timeout: 30_000,
}); });
const mastoAccount = await masto.accounts.verifyCredentials(); const mastoAccount = await masto.accounts.verifyCredentials();
@ -185,6 +186,7 @@ export function App() {
url: `https://${instanceURL}`, url: `https://${instanceURL}`,
accessToken, accessToken,
disableVersionCheck: true, disableVersionCheck: true,
timeout: 30_000,
}); });
setIsLoggedIn(true); setIsLoggedIn(true);
} catch (e) { } catch (e) {

View file

@ -542,7 +542,6 @@ function Compose({
const params = { const params = {
file, file,
description, description,
skipPolling: true,
}; };
return masto.mediaAttachments.create(params).then((res) => { return masto.mediaAttachments.create(params).then((res) => {
if (res.id) { if (res.id) {

View file

@ -29,6 +29,7 @@ if (window.opener) {
url: `https://${instanceURL}`, url: `https://${instanceURL}`,
accessToken, accessToken,
disableVersionCheck: true, disableVersionCheck: true,
timeout: 30_000,
}); });
console.info('Logged in successfully.'); console.info('Logged in successfully.');
} catch (e) { } catch (e) {