Skip to content

Lifecycle Reducers dicsonnect exmaple uses insert instead of try_insert #3970

@CorrM

Description

@CorrM

in Lifecycle Reducers on connected example uses insert instead of try_insert:

ctx.db.sessions().insert(Session {
        connection_id: conn_id,
        identity: ctx.sender,
        connected_at: ctx.timestamp,
    })?;

the problem are ? which expect Result while insert returns the inserted row.

One more question:
session are created when client connected, and session removed when client disconnected.
what will happen if the server for any reason closed between this two events? session will get removed?

also what the schema of Session in the example? did identity or connection_id is the primary key?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions