mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #2736 from omnivore-app/feat/backend-fixups
A couple small backend cleanups to reduce errors
This commit is contained in:
commit
89c612e52b
7 changed files with 12 additions and 12 deletions
|
|
@ -113,7 +113,7 @@ class LoginViewModel @Inject constructor(
|
|||
validateUsernameJob?.cancel()
|
||||
|
||||
validateUsernameJob = viewModelScope.launch {
|
||||
delay(500)
|
||||
delay(2000)
|
||||
|
||||
// Check the username requirements first
|
||||
if (potentialUsername.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ import Views
|
|||
potentialUsername = profile.username
|
||||
|
||||
$potentialUsername
|
||||
.debounce(for: .seconds(0.5), scheduler: DispatchQueue.main)
|
||||
.debounce(for: .seconds(2.0), scheduler: DispatchQueue.main)
|
||||
.sink(receiveValue: { [weak self] username in
|
||||
self?.validateUsername(username: username, dataService: dataService)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ export function makeApolloServer(): ApolloServer {
|
|||
return new Error('Unexpected server error')
|
||||
},
|
||||
introspection: env.dev.isLocal,
|
||||
persistedQueries: false,
|
||||
})
|
||||
|
||||
return apollo
|
||||
|
|
|
|||
|
|
@ -107,14 +107,14 @@ export const createApp = (): {
|
|||
const apiLimiter = rateLimit({
|
||||
windowMs: 60 * 1000, // 1 minute
|
||||
max: async (req) => {
|
||||
// 100 RPM for an authenticated request, 5 for a non-authenticated request
|
||||
// 100 RPM for an authenticated request, 15 for a non-authenticated request
|
||||
const token = getTokenByRequest(req)
|
||||
try {
|
||||
const claims = await getClaimsByToken(token)
|
||||
return claims ? 100 : 5
|
||||
return claims ? 100 : 15
|
||||
} catch (e) {
|
||||
console.log('non-authenticated request')
|
||||
return 5
|
||||
return 15
|
||||
}
|
||||
},
|
||||
keyGenerator: (req) => {
|
||||
|
|
|
|||
|
|
@ -347,12 +347,12 @@ export const textToSpeechStreamingHandler = Sentry.GCPFunction.wrapHttpFunction(
|
|||
}
|
||||
|
||||
const audioDataString = audioData.toString('hex')
|
||||
// save audio data to cache for 24 hours for mainly the newsletters
|
||||
// save audio data to cache for 72 hours for mainly the newsletters
|
||||
await redisClient.set(
|
||||
cacheKey,
|
||||
JSON.stringify({ audioDataString, speechMarks }),
|
||||
{
|
||||
EX: 3600 * 24, // in seconds
|
||||
EX: 3600 * 72, // in seconds
|
||||
NX: true,
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export function ConfirmProfileModal(): JSX.Element {
|
|||
setUsername(event.target.value)
|
||||
setTimeout(() => {
|
||||
setDebouncedUsername(event.target.value)
|
||||
}, 400)
|
||||
}, 2000)
|
||||
},
|
||||
[]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -18,9 +18,8 @@ export function EmailSignup(): JSX.Element {
|
|||
const [password, setPassword] = useState<string | undefined>()
|
||||
const [fullname, setFullname] = useState<string | undefined>()
|
||||
const [username, setUsername] = useState<string | undefined>()
|
||||
const [debouncedUsername, setDebouncedUsername] = useState<
|
||||
string | undefined
|
||||
>()
|
||||
const [debouncedUsername, setDebouncedUsername] =
|
||||
useState<string | undefined>()
|
||||
const [errorMessage, setErrorMessage] = useState<string | undefined>()
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -41,7 +40,7 @@ export function EmailSignup(): JSX.Element {
|
|||
setUsername(event.target.value)
|
||||
setTimeout(() => {
|
||||
setDebouncedUsername(event.target.value)
|
||||
}, 400)
|
||||
}, 2000)
|
||||
},
|
||||
[]
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue