Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7045


Ignore:
Timestamp:
11/22/11 18:13:48 (13 years ago)
Author:
ascheibe
Message:

#1672 switch more service calls to IsolationLevel=ReadUncommitted transactions to prevent db deadlocks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r6983 r7045  
    8787      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    8888      author.AuthorizeForTask(taskId, Permission.Read);
    89       return dao.GetTask(taskId);
     89
     90      return trans.UseTransaction(() => {
     91        return dao.GetTask(taskId);
     92      }, false, false);
    9093    }
    9194
     
    100103    public IEnumerable<LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds) {
    101104      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    102       var tasks = dao.GetTasks(x => taskIds.Contains(x.TaskId)).Select(x => new LightweightTask(x)).ToArray();
    103       foreach (var task in tasks)
    104         author.AuthorizeForTask(task.Id, Permission.Read);
    105       return tasks;
     105
     106      return trans.UseTransaction(() => {
     107        var tasks = dao.GetTasks(x => taskIds.Contains(x.TaskId)).Select(x => new LightweightTask(x)).ToArray();
     108        foreach (var task in tasks)
     109          author.AuthorizeForTask(task.Id, Permission.Read);
     110        return tasks;
     111      }, false, false);
    106112    }
    107113
    108114    public IEnumerable<LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent) {
    109115      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    110       var tasks = GetChildTasks(parentTaskId, recursive, includeParent).Select(x => new LightweightTask(x)).ToArray();
    111       foreach (var task in tasks)
    112         author.AuthorizeForTask(task.Id, Permission.Read);
    113       return tasks;
     116
     117      return trans.UseTransaction(() => {
     118        var tasks = GetChildTasks(parentTaskId, recursive, includeParent).Select(x => new LightweightTask(x)).ToArray();
     119        foreach (var task in tasks)
     120          author.AuthorizeForTask(task.Id, Permission.Read);
     121        return tasks;
     122      }, false, false);
    114123    }
    115124
     
    117126      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    118127      author.AuthorizeForJob(jobId, Permission.Read);
    119       return dao.GetTasks(x => x.JobId == jobId).Select(x => new LightweightTask(x)).ToArray();
     128
     129      return trans.UseTransaction(() => {
     130        return dao.GetTasks(x => x.JobId == jobId).Select(x => new LightweightTask(x)).ToArray();
     131      }, false, false);
    120132    }
    121133
Note: See TracChangeset for help on using the changeset viewer.