mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-12-09 05:36:27 +08:00
ALIDNS: Add concurrency support
This commit is contained in:
parent
7d564a1cb7
commit
8bae0abc78
3 changed files with 11 additions and 4 deletions
|
|
@ -91,7 +91,7 @@ Jump to a table:
|
|||
| ------------- | -------------------------------------------------------------------- | ---------------------------------------------- | -------------- | --------- |
|
||||
| [`ADGUARDHOME`](adguardhome.md) | ❔ | ❔ | ❌ | ❌ |
|
||||
| [`AKAMAIEDGEDNS`](akamaiedgedns.md) | ❔ | ✅ | ✅ | ✅ |
|
||||
| [`ALIDNS`](alidns.md) | ❌ | ❌ | ❌ | ❔ |
|
||||
| [`ALIDNS`](alidns.md) | ✅ | ❌ | ❌ | ❔ |
|
||||
| [`AUTODNS`](autodns.md) | ✅ | ❌ | ❌ | ✅ |
|
||||
| [`AXFRDDNS`](axfrddns.md) | ✅ | ❌ | ❌ | ❌ |
|
||||
| [`AZURE_DNS`](azure_dns.md) | ✅ | ✅ | ✅ | ✅ |
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/v4/models"
|
||||
"github.com/StackExchange/dnscontrol/v4/pkg/diff2"
|
||||
|
|
@ -21,7 +22,7 @@ var features = providers.DocumentationNotes{
|
|||
providers.CanUseSSHFP: providers.Cannot(),
|
||||
providers.CanUseTLSA: providers.Cannot(),
|
||||
providers.CanAutoDNSSEC: providers.Cannot(),
|
||||
providers.CanConcur: providers.Cannot(),
|
||||
providers.CanConcur: providers.Can(),
|
||||
providers.DocOfficiallySupported: providers.Cannot(),
|
||||
providers.DocDualHost: providers.Cannot(),
|
||||
providers.DocCreateDomains: providers.Cannot(),
|
||||
|
|
@ -50,6 +51,7 @@ func init() {
|
|||
type aliDnsDsp struct {
|
||||
client *alidns.Client
|
||||
domainVersionCache map[string]*domainVersionInfo
|
||||
cacheMu sync.Mutex
|
||||
}
|
||||
|
||||
type domainVersionInfo struct {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@ import (
|
|||
|
||||
func (a *aliDnsDsp) getDomainVersionInfo(domain string) (*domainVersionInfo, error) {
|
||||
// Check cache first
|
||||
if info, ok := a.domainVersionCache[domain]; ok {
|
||||
a.cacheMu.Lock()
|
||||
info, ok := a.domainVersionCache[domain]
|
||||
a.cacheMu.Unlock()
|
||||
if ok {
|
||||
return info, nil
|
||||
}
|
||||
|
||||
|
|
@ -38,12 +41,14 @@ func (a *aliDnsDsp) getDomainVersionInfo(domain string) (*domainVersionInfo, err
|
|||
}
|
||||
}
|
||||
|
||||
info := &domainVersionInfo{
|
||||
info = &domainVersionInfo{
|
||||
versionCode: resp.VersionCode,
|
||||
minTTL: minTTL,
|
||||
maxTTL: 86400,
|
||||
}
|
||||
a.cacheMu.Lock()
|
||||
a.domainVersionCache[domain] = info
|
||||
a.cacheMu.Unlock()
|
||||
return info, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue