func New(meta model.Meta, cfg *config.Config, grpcAuthority string) (*Diun, error) {
	var err error
	diun := &Diun{
		meta: meta,
		cfg:  cfg,
		cron: cron.New(cron.WithParser(cron.NewParser(
			cron.SecondOptional | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor),
		)),
	}
	diun.notif, err = notif.New(cfg.Notif, meta)
	if err != nil {
		return nil, err
	}
	diun.db, err = db.New(*cfg.Db)
	if err != nil {
		return nil, err
	}
	diun.grpc, err = grpc.New(grpcAuthority, diun.db, diun.notif)
	if err != nil {
		return nil, err
	}
	if cfg.Watch.Healthchecks != nil {
		var hcBaseURL *url.URL
		if len(cfg.Watch.Healthchecks.BaseURL) > 0 {
			hcBaseURL, err = url.Parse(cfg.Watch.Healthchecks.BaseURL)
			if err != nil {
				return nil, errors.Wrap(err, "Cannot parse Healthchecks base URL")
			}
		}
		diun.hc = gohealthchecks.NewClient(&gohealthchecks.ClientOptions{
			BaseURL: hcBaseURL,
		})
	}
	return diun, nil
}
New creates new diun instance
package app
import (
	"net/url"
	"sync"
	"sync/atomic"
	"time"
	"github.com/crazy-max/diun/v4/internal/config"
	"github.com/crazy-max/diun/v4/internal/db"
	"github.com/crazy-max/diun/v4/internal/grpc"
	"github.com/crazy-max/diun/v4/internal/logging"
	"github.com/crazy-max/diun/v4/internal/model"
	"github.com/crazy-max/diun/v4/internal/notif"
	dockerPrd "github.com/crazy-max/diun/v4/internal/provider/docker"
	dockerfilePrd "github.com/crazy-max/diun/v4/internal/provider/dockerfile"
	filePrd "github.com/crazy-max/diun/v4/internal/provider/file"
	kubernetesPrd "github.com/crazy-max/diun/v4/internal/provider/kubernetes"
	swarmPrd "github.com/crazy-max/diun/v4/internal/provider/swarm"
	"github.com/crazy-max/gohealthchecks"
	"github.com/hako/durafmt"
	"github.com/panjf2000/ants/v2"
	"github.com/pkg/errors"
	"github.com/robfig/cron/v3"
	"github.com/rs/zerolog/log"
)
type Diun struct {
	meta model.Meta
	cfg  *config.Config
	db    *db.Client
	grpc  *grpc.Client
	hc    *gohealthchecks.Client
	notif *notif.Client
	cron   *cron.Cron
	jobID  cron.EntryID
	locker uint32
	pool   *ants.PoolWithFunc
	wg     *sync.WaitGroup
}