question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

refactor setting TTL in vehicles.js

See original GitHub issue

Thank you for your help ❤️

What is this project?

DAV (Decentralized Autonomous Vehicles) is a new foundation working to build an open-source infrastructure for autonomous vehicles (cars, drones, trucks, robots, and all the service providers around them) to communicate and transact with each other over blockchain.

The specific project you are looking at is Mission Control. It is the brain in charge of orchestrating missions between DAV users and autonomous vehicles.

How you can help

Mission Control comes with a built in simulation environment which generates and controls simulated vehicles, allowing developers to start developing without investing in costly hardware first.

One of the things the simulator does is keep track of requests for delivery missions.

Once created, those simulated requests remain indefinitely in memory.

Once we have many developers from around the world experimenting with the simulation environment, more and more requests will be created and kept in memory and never deleted.

What you can do

We need to add a TTL (Time To Live) expiration to the requests stored in Redis so that they are deleted automatically after some time.

In the file /server/store/vehicles.js the code used to set TTL redis.expire(`vehicles:${vehicle.id}`, config('vehicles_ttl')); is repeated twice. The task for this issue is to refactor that code by moving it to a separate function with the name setVehicleTTL(vehicleId).

Contributing to Mission Control

  • Make sure this issue is labeled up-for-grabs and not labeled claimed, to verify no one else is working on it.
  • Comment in this issue that you would like to do it.
  • Open the Mission Control GitHub page and click the ★ Star and then ⑂ Fork buttons.
  • Clone a copy to your local machine with $ git clone git@github.com:YOUR-GITHUB-USER-NAME/missioncontrol.git
  • **Code Code Code **
  • Once you’ve made sure all your changes work correctly and committed all your changes, push your local changes back to github with $ git push -u origin master
  • Visit your fork on GitHub.com (https://github.com/YOUR-USER-NAME/missioncontrol) and create a pull request for your changes.
  • Make sure your pull request describes exactly what you changed and references this issue (include the issue number in the title like this: #5)
  • Please do not fix more than one issue at a time. Your pull request should only fix what is described in this issue.

Asking for help

We appreciate your effort in taking the time to work on this issue and help out the open source community and the foundation. If you need any help, feel free to ask below or in our gitter channel. We are always happy to help 😄

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
hmainismaelcommented, Feb 18, 2018

Thanks a lot for your help!

0reactions
cg-cnucommented, Feb 18, 2018

Congratulations @hmainismael on your first contribution to open source! And thank you being patient and fixing the additional review comments. We really appreciate it. Hope you had fun and learned few things doing this PR. Feel free to join our gitter channel to find out more opportunities 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

ttl not working in loopback when I set it for a Model
This script will create a job which deletes all rows who have expired according to their ttl column. server/boot/job-delete-expired.js
Read more >
JavaScript Refactoring: 5 Plays to Improve Code Quality
JavaScript refactoring can help you improve your code quality. Learn 5 steps you can take to do so, and end up with a...
Read more >
Kikobeats/cacheable-response: An HTTP compliant route path ...
After ttl period expired, the cache will be invalidated and refreshed in the next request. In case you need you can force invalidate...
Read more >
Dynamically Extending A Long-Lived Distributed Locks With ...
And, when the key is set, it is defined with a TTL, or Time-To-Live, which defines how long the key can exist before...
Read more >
Time To Live (TTL) - Expire Nodes - APOC Extended ... - Neo4j
The ttl property holds the time when the node is expired in milliseconds since epoch. Create an index on the time-to-live label and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found