Moodle
  1. Moodle
  2. MDL-14591 META: Develop new Portfolio API
  3. MDL-20872

fix race condition between pull plugins and user "finished export" page

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Portfolio API
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      32867

      Description

      16:22 < penny> i have this weird race condition
      16:22 < penny> in the portfolio api
      16:23 < penny> for "pull" plugins, which are plugins that send a notification to some external system, which
      then wakes up and requests the file
      16:23 < penny> eg mahara
      16:23 < penny> the problem is, that when the file is pulled down, the portfolio transfer stuff is deleted
      16:23 < penny> because it's finished
      16:23 < penny> but if that pull request happens before the "your portfolio export request has been sent"
      message is displayed to the user
      16:24 < penny> like, if mahara's xmlrpc handler is quicker than the moodle browser redirect
      16:24 < penny> the user gets an error, because already the portfolio transfer is deleted before their page
      is loaded
      16:24 * penny wonders if she has explained this clearly
      16:25 < mudrd8mz> give me sec to think about
      16:25 < mudrd8mz> BTW some sort of UML sequence diagram would help ...
      16:27 < penny> yeah i just drew it on a piece of paper
      16:27 < mudrd8mz> penny: why do you delete the transfer record instead of a flag "finished"
      16:28 < mudrd8mz> (i drew as well
      16:28 < penny> yeah that's what i'm going to have to do
      16:28 < penny> i mean, i log it anyway, just ikn a separate table
      16:28 < penny> but i guess i'll have to detect this case
      16:28 < mudrd8mz> You can keep them for some time
      16:29 < mudrd8mz> if not forever?
      16:29 < penny> the logs yes
      16:29 < penny> the tempdata no
      16:29 < penny> it's too big
      16:29 < mudrd8mz> ah
      16:29 < penny> i can add the tempdata id onto the log table
      16:29 < penny> so that the code that throws an exception when it can't find the tempdata can check there and
      say
      16:29 < mudrd8mz> or:
      16:29 < penny> "ah ha" this has finished!
      16:29 < mudrd8mz> yes
      16:29 * penny was debugging this for ages
      16:30 < mudrd8mz> 1) check actual exports 2) check logs
      16:30 < penny> yeah exactly
      16:30 < mudrd8mz> does every export have it unique id?
      16:30 < penny> yes
      16:31 < penny> a pk in portfolio_tempdata

        Activity

        Hide
        Penny Leach added a comment -

        fixed with log table.

        Show
        Penny Leach added a comment - fixed with log table.

          People

          • Assignee:
            Penny Leach
            Reporter:
            Penny Leach
            Tester:
            Nobody
            Participants:
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: