Code Monkey home page Code Monkey logo

distrava's Introduction

Distrava

How to setup

This project requires node12 and gcloud cli to be installed.

To install dependencies, run npm i To start the app locally run npm run start To deploy the app on google cloud functions, run npm run deploy.

distrava's People

Contributors

karthikb351 avatar dependabot[bot] avatar

Stargazers

Kishore Narendran avatar Abhi Ramani avatar

Watchers

 avatar Kishore Narendran avatar  avatar

distrava's Issues

Identify cold starts during Strava webhooks and reject early

Strava retries webhooks that aren't acknowledged within 2 seconds. Our cold start might take longer, so we should actually reject the webhook if we're receiving it 2 seconds after it was started.

If the Strava webhook request has a timestamp header, we can check if we're within the 2 seconds window, else reject it and strava retry us (and hopefully hit a warm function).

Don't reject strava webhook if it's the last retry

Check the Finagle-Ctx-com.twitter.finagle.Retries header to see if it's the last retry. In which case we should ignore the deadline since we won't be called again and we should process the request.

Add additional information to `/get_last_activity` command

The Strava API provides richer information about an activity, some of the information that might be worth adding to the bot's response are:

  • Elapsed Time
  • Distance
  • Total Elevation Gain
  • Embeddable Map of the activity

There are many more pieces of information, that are perhaps overkill. But worth considering expanding beyond title, and description, especially since most people use auto-generated titles and no description, so it's harder to distinguish anyway.

Use GCP's Secret Manager over GitHub Secrets

GCP's secret manager is easier to store and retrieve config values, we should use https://github.com/google-github-actions/get-secretmanager-secrets to fetch secrets in our actions.

We also need to have a workflow to pull this value in our dev environment (codespaces or otherwise).

Use Pub/Sub for Strava webhook events

We need to acknowledge Strava webhook events within 2 seconds, so we should acknowledge early and push the event on Pub/Sub and handle them asynchronously.

Fix multiline logs on GCP Logger

Currently using console.log for logging results in GCP's logging view showing them in separate lines.

Example:
Screenshot 2021-07-10 at 9 34 07 PM

We should use a standard logging tool that Google's cloud functions supports well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.