You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: pipeline_reconciler.go
    path of file: ./repos/erda/internal/tools/pipeline/providers/reconciler
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of th
    
func (pr *defaultPipelineReconciler) UpdateCurrentReconcileStatusIfNecessary(ctx context.Context, p *spec.Pipeline) error {
	// no change, exit
	if p.Status == pr.calculatedStatusForTaskUse {
		return nil
	}
	// changed, update pipeline status
	//_, err = pr.dbClient.Transaction(func(s *xorm.Session) (interface{}, error) {
	// update status
	if err := pr.dbClient.UpdatePipelineBaseStatus(p.ID, pr.calculatedStatusForTaskUse); err != nil {
		return err
	}
	pr.log.Infof("pipelineID: %d, update pipeline status (%s -> %s)", p.ID, p.Status, pr.calculatedStatusForTaskUse)
	p.Status = pr.calculatedStatusForTaskUse
	// send event
	events.EmitPipelineInstanceEvent(p, p.GetUserID())
	return nil
	//})
	//if err != nil {
	//	return err
	//}

	//return nil
}