Skip to content
Snippets Groups Projects
  • Jared Hancock's avatar
    orm: Fix issues surrounding MySQL commands OoS · 8dc4f379
    Jared Hancock authored
    Several places in the code initialize a list of objects from the database
    and only fetch one item. In certain instances (which seem almost like a race
    condition), MySQL will feel like there are more records available in the
    database and will complain with "Commands out of sync, you can't run the
    command now".
    
    This patch addresses the issue by utilizing the ::one() method of the
    QuerySet where only one record is expected. The ::one() method is further
    designed to fetch all one results (which satisfies the MySQL client library)
    and return the first item.
    8dc4f379