Hi,
I want to check running jobs for dont run twice. How can i do that ?
If we set hangfire for background job processor, i think we can not use backgroundjobinfo and other tables because it is empty when jobs running on hangfire.
Ok i reproduce the problem.
I created role and give permisions to this role I create a user I create a organizational unit and give this role to this unit Add this organization unit to this user.
Everything ok and work
I edit user permission and unselect all permission's. And save He also owns organizational unit. And can not go pagess. I took and and organizational unit again but nothing changed.
I think user can take permissions from organiational unit if i take from permissions. Or if i take org unit and give again permission may be added again.
In my site i tried my first question it is working. I can not reproduce again. I will try again.
You can check my second question.
I reproduced my second question. I am trying first one.
http://df514972.demo.aspnetzero.com
admin 123456
You can check user muhittin.celik's roles.
And when i deleted organizational unit. Users roles can not be changed which came from organizational unit. This roles' checkbox disabled. There is a info like 'this role came from organizational unit'. Bu there are no organizational unit.
I think it is a bug..
Hi,
I created a new role and a new user.
I added permission to role.
User can go entities if i gave this role to him. But when i gave this role from organizational unit he can not go entities. Also can not see this module in menu.
I used 8.1 Core Angular..
Hi,
I passed TenantId with Job Args and it is ok now.
await _backgroundJobManager.EnqueueAsync<ScanWinSQLInstanceStagesJob, ScanWinSQLInstanceStagesJobArgs>(
new ScanWinSQLInstanceStagesJobArgs
{
WindowsHostStageId = item.Id,
CurrentTenantId = AbpSession.TenantId.GetValueOrDefault()
});
if (_winSQLInstanceStage != null)
{
_winSQLInstanceStageRepository.Update(_winSQLInstanceStage);
}
else
{
var _winSQLInstanceStage_Temp = _objectMapper.Map<WinSQLInstanceStage>(winSQLInstance);
_winSQLInstanceStage_Temp.TenantId = args.CurrentTenantId;
_winSQLInstanceStageRepository.Insert(_winSQLInstanceStage_Temp);
}
public class ScanWinSQLInstanceStagesJob : BackgroundJob<ScanWinSQLInstanceStagesJobArgs>, ITransientDependency
{
private readonly IRepository<WindowsHostStage, long> _windowsHostStageRepository;
private readonly IRepository<WinSQLInstanceStage, long> _winSQLInstanceStageRepository;
private readonly IObjectMapper _objectMapper;
public ScanWinSQLInstanceStagesJob(
IRepository<WindowsHostStage, long> windowsHostStageRepository,
IRepository<WinSQLInstanceStage, long> winSQLInstanceStageRepository,
IObjectMapper objectMapper
)
{
_windowsHostStageRepository = windowsHostStageRepository;
_winSQLInstanceStageRepository = winSQLInstanceStageRepository;
_objectMapper = objectMapper;
}
[UnitOfWork]
public override void Execute(ScanWinSQLInstanceStagesJobArgs args)
{
var windowsHostStage = _windowsHostStageRepository.Get(args.WindowsHostStageId);
List<GetWMIWinSQLInstanceOutput> winSQLInstances = GetWMI_WinSQLInstances.EnumerateSQLInstances(windowsHostStage.Name);
foreach (GetWMIWinSQLInstanceOutput winSQLInstance in winSQLInstances)
{
var _winSQLInstanceStage = _winSQLInstanceStageRepository.FirstOrDefault(s => s.Hostname == winSQLInstance.Hostname & s.InstanceName == winSQLInstance.InstanceName);
if (_winSQLInstanceStage != null)
{
_winSQLInstanceStageRepository.Update(_winSQLInstanceStage);
}
else
{
_winSQLInstanceStageRepository.Insert(_objectMapper.Map<WinSQLInstanceStage>(winSQLInstance));
}
}
}
}
[Serializable]
public class ScanWinSQLInstanceStagesJobArgs
{
public long WindowsHostStageId { get; set; }
}
var windowsHostStage = _windowsHostStageRepository.GetAllList();
foreach (WindowsHostStage item in windowsHostStage)
{
await _backgroundJobManager.EnqueueAsync<ScanWinSQLInstanceStagesJob, ScanWinSQLInstanceStagesJobArgs>(
new ScanWinSQLInstanceStagesJobArgs
{
WindowsHostStageId = item.Id
});
}
I got the following error when insert new record. It can update records.
WARN 2019-12-25 15:20:58,634 [er #1] Hangfire.AutomaticRetryAttribute - Failed to process the job '76': an exception occurred. Retry attempt 4 of 10 will be performed in 00:02:24. Abp.AbpException: Can not set TenantId to 0 for IMustHaveTenant entities!
I tried npm run create-bundle three time it freezes with last message "Finished 'buildDev' after xx s.
Bu public site running now.