Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[server] make all SQL changes atomic #142

Open
waleko opened this issue May 7, 2022 · 0 comments
Open

[server] make all SQL changes atomic #142

waleko opened this issue May 7, 2022 · 0 comments
Assignees
Labels
bug Something isn't working server

Comments

@waleko
Copy link
Member

waleko commented May 7, 2022

  • тут достаточно update_by

    auto session = default_mp_sessions.findOne(
    Criteria(drogon_model::cavoke_orm::Sessions::Cols::_id,
    CompareOperator::EQ, id));
    session.setStatus(FINISHED);
    default_mp_sessions.update(session);

  • тут придётся написать кастомную sql функцию, как в host-memorization

    auto session = default_mp_sessions.findOne(
    Criteria(drogon_model::cavoke_orm::Sessions::Cols::_id,
    CompareOperator::EQ, id));
    // FIXME: not atomic, transactions perhaps or some other blocking
    // sql-mechanism?
    if (session.getValueOfStatus() != NOT_STARTED) {
    throw game_session_error("session has already started");
    }
    session.setGameSettings(game_settings.dump());
    session.setStatus(RUNNING);
    default_mp_sessions.update(session);

@waleko waleko added bug Something isn't working server labels May 7, 2022
@waleko waleko self-assigned this May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working server
Projects
None yet
Development

No branches or pull requests

1 participant