mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
toggling on wf feature sync endpoint since we know the request load now (#30014)
GitOrigin-RevId: d7f9944caffdcb5cf42693cac7d2895026b38775
This commit is contained in:
committed by
Copybot
parent
580fc2bad6
commit
ea5de4984f
@@ -16,8 +16,7 @@ import AnalyticsManager from '../Analytics/AnalyticsManager.mjs'
|
||||
import Queues from '../../infrastructure/Queues.mjs'
|
||||
import Modules from '../../infrastructure/Modules.mjs'
|
||||
import { AI_ADD_ON_CODE } from './AiHelper.mjs'
|
||||
// import { fetchNothing } from '@overleaf/fetch-utils'
|
||||
import metrics from '@overleaf/metrics'
|
||||
import { fetchNothing } from '@overleaf/fetch-utils'
|
||||
|
||||
/**
|
||||
* Enqueue a job for refreshing features for the given user
|
||||
@@ -78,22 +77,21 @@ async function refreshFeatures(userId, reason) {
|
||||
if (featuresChanged && reason !== 'writefullEntitlementSynced') {
|
||||
try {
|
||||
// update WF with the current feature set for the user
|
||||
// await fetchNothing(
|
||||
// `${Settings.writefull.overleafApiUrl}/api/user/status/update-overleaf-status`,
|
||||
// {
|
||||
// headers: {
|
||||
// 'x-api-key': Settings.writefull.overleafApiKey,
|
||||
// },
|
||||
// json: {
|
||||
// userOverleafId: userId,
|
||||
// hasAiAssist: newFeatures.aiErrorAssistant,
|
||||
// },
|
||||
// method: 'POST',
|
||||
// }
|
||||
// )
|
||||
// increment a metric instead of calling WF so we cna give them an idea of the # of requests they will recieve
|
||||
metrics.inc('feature_sync_called_to_wf')
|
||||
await fetchNothing(
|
||||
`${Settings.writefull.overleafApiUrl}/api/user/status/update-overleaf-status`,
|
||||
{
|
||||
headers: {
|
||||
'x-api-key': Settings.writefull.overleafApiKey,
|
||||
},
|
||||
json: {
|
||||
userOverleafId: userId,
|
||||
hasAiAssist: newFeatures.aiErrorAssistant,
|
||||
},
|
||||
method: 'POST',
|
||||
}
|
||||
)
|
||||
} catch (err) {
|
||||
// continue with sync even if we cant communicate with wf
|
||||
logger.warn(
|
||||
{ userId, reason },
|
||||
'failed to sync entitlement to Writefull after a feature refresh'
|
||||
|
||||
Reference in New Issue
Block a user