dice-with-microservices's People
Forkers
giobartdice-with-microservices's Issues
Bug with rolled dices and roll persistance
While working on the feature of draft stories, I've found that we do not store the rolls of a story, therefore is impossible to edit and check a drafted story.
At this moment (see #20), whenever we roll dices in the rollDice
endpoint we save the result in a global variable that is read by the writeStory
endpoint. This means that if another roll happens during the process of writing the story, the roll will be overwritten and the checks would fail unexpectedly, and this is not tested. So we need to find another way of dealing with the roll. Some proposal are
- Send the roll to the client GET and request it back with the POST, this means that the user has control over the dice rolls, but requires minor changes.
- Save an index of rolls in memory, the fastest solution but memory intensive.
- Since I'm implementing the editing functionality for drafts, when we roll we create an empty draft with the rolls already in the database and we redirect the user to the edit functionality where he can left the story as a draft or complete the submission.
In my opinion the solution 3 is the best one. No other data structures are needed, no risk of race conditions and the only drawback is that we can have some, minor, number of empty drafts in the database until completion.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.