Live Counter - Best implementation?

Hi, I’m looking to implement a live counter on our site whereby multiple users can increment or decrement the counter simultaneously. My thoughts on how to implement were: - Add counter (Integer on db) to form with action buttons to increment / decrement - Use Microflow Timer widget to exec microflow to refresh the counter from database (may need to refresh every second) I’m guessing this would be terribly inefficient and could cause deadlocks? Any better ways of doing this?  Thanks in advance    
2 answers

I think your solution using the microflow timer and action buttons will work just fine.

As long as you don't put a lot of other logic in the microflows, i don't think you need to worry about deadlocks.

I believe there could be an odd case where two users click the same button at exactly the same time microsecond and one vote gets lost. Would that be a major problem in your use case? If that would be an issue (eg in case of a governement election system), i suggest you implement a separate locking mechanism using one of the appstore components. In practice this is pretty hard to get right and lowers efficiency, so personally i would avoid this if not strictly necessary.


U ‘d better use a outside counter written by java.

Call ‘d by mendix.