[go: nahoru, domu]

Skip to content

Commit

Permalink
Fix the 404 error for New Authors (#631)
Browse files Browse the repository at this point in the history
* Recommended repos support added

* lint fix

* approval date added

* firebase functions error handling added

* deploy refreshAuthors cloud function

* removed test files

* refreshAuthors pushed to CI/CD

* corrected quotes issue

* function type changes

* function made https

* adding test data

* test function updates

* test files added and removed

* testing data removal
  • Loading branch information
shadowshot-x committed Mar 1, 2023
1 parent 6e2e221 commit a01b45d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cloudbuild/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ steps:
args: ['--prefix=shared', 'run', 'deploy:firebase']
env:
- 'FIREBASE_PROJECT=$PROJECT_ID'
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
dir: 'app'
args: ['gcloud', '--project=$PROJECT_ID', 'functions', 'call', 'refreshAuthors']
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
dir: 'app'
args: ['gcloud', '--project=$PROJECT_ID', 'app', 'deploy', '--stop-previous-version']
16 changes: 16 additions & 0 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,22 @@ export const refreshProjectsCron = functions
await refreshAllAuthors();
});

// Cron job to refresh Authors
export const refreshAuthors = functions.runWith({
memory: "2GB",
timeoutSeconds: 540,
}).https.onRequest(
async (request, response) => {
try{
await refreshAllAuthors();
} catch (e){
console.log(e)
response.status(400).json({ e });
}
response.json({ status: "ok" });
}
);

// When in the functions emulator we provide some simple webhooks to refresh things
if (process.env.FUNCTIONS_EMULATOR) {
exports.refreshProjects = functions.https.onRequest(
Expand Down

0 comments on commit a01b45d

Please sign in to comment.